HNX Posted December 14, 2007 Share Posted December 14, 2007 ok here is my code <?php $form = true; if(isset($_POST['Submit'])){ $to = "capcom_azn@hotmail.com"; $subject = $_POST['subject']; $message = $_POST['detail']; $from = $_POST['name']; $headers = "From: $from"; if(($to == "")||($subject == "")||($message == "")||($from == "")){ echo "Please fill in all the fields"; $form = true; } else{ //echo "Thank you for your interest, your e-mail was sent."; echo "Thank you for your interest, your e-mail was sent."; $form = false; } } if($form == true){ print '<form action="" method=post name=form1 id=form1>'; print '<table width="100%" border="0" cellspacing="1" cellpadding="3">'; print '<tr>'; print '<td width="16%"><span class="style108">Subject</span></td>'; print '<td width="2%"><span class="style104">:</span></td>'; print '<td width="82%"><input name="subject" type="text" id="subject" size="50" /></td>'; print '</tr>'; print '<tr>'; print '<td><span class="style108">Message</span></td>'; print '<td><span class="style104">:</span></td>'; print '<td><textarea name="detail" cols="50" rows="4" id="detail"></textarea></td>'; print '</tr>'; print '<tr>'; print '<td><span class="style108">Name</span></td>'; print '<td><span class="style104">:</span></td>'; print '<td><input name="name" type="text" id="name" size="50" /></td>'; print '</tr>'; print '<tr>'; print '<td><span class="style108">Email</span></td>'; print '<td><span class="style104">:</span></td>'; print '<td><input name="customer_mail" type="text" id="customer_mail" size="50" /></td>'; print '</tr>'; print '<tr>'; print '<td> </td>'; print '<td> </td>'; print '<td><input type="submit" name="Submit" value="Submit" />'; print '<input type="reset" name="Submit2" value="Reset" /></td>'; print '</tr>'; print'</table>'; print'</form>'; } ?> its all working but theres one problem when i fill the field where it says Email and i submit i dont receive the email i entered in :s Quote Link to comment Share on other sites More sharing options...
trq Posted December 14, 2007 Share Posted December 14, 2007 Nowhere in your code do you attempt to send an email. Take a look at the mail function. Quote Link to comment Share on other sites More sharing options...
farkewie Posted December 14, 2007 Share Posted December 14, 2007 http://au.php.net/manual/en/function.mail.php Quote Link to comment Share on other sites More sharing options...
HNX Posted December 14, 2007 Author Share Posted December 14, 2007 is this the code i need to input?? mail($to, $subject, $message, $headers); ?> ???and if so where and how should i do it? (i want to see the email of the guys that submits the form) Quote Link to comment Share on other sites More sharing options...
HNX Posted December 14, 2007 Author Share Posted December 14, 2007 euh can you at least answer my question? Quote Link to comment Share on other sites More sharing options...
HNX Posted December 14, 2007 Author Share Posted December 14, 2007 PHPSENSEI!!!!!!!!1 nobody seems to care about me Loll u helpme instead of these guys Lol Quote Link to comment Share on other sites More sharing options...
HNX Posted December 14, 2007 Author Share Posted December 14, 2007 aight sensei i saw that ur online Lol please help me with this i know its a lil problem its be fixed immedialy Lol Quote Link to comment Share on other sites More sharing options...
farkewie Posted December 14, 2007 Share Posted December 14, 2007 Really! you should just try something! your not going to break anything. just post your code when it doesnt work. Hint: it goes in after you have made sure all the fields are filled in correctly. Quote Link to comment Share on other sites More sharing options...
phpSensei Posted December 14, 2007 Share Posted December 14, 2007 aight sensei i saw that ur online Lol please help me with this i know its a lil problem its be fixed immedialy Lol You didnt use the new code I gave you. ONE sec, I will post it for you. Sorry, this must of have been my fault. Quote Link to comment Share on other sites More sharing options...
phpSensei Posted December 14, 2007 Share Posted December 14, 2007 Okay, here is the script. <?php $form = true; if(isset($_POST['Submit'])){ $to = "info@growth-flexvpro.net"; $subject = $_POST['subject']; $message = $_POST['detail']; $from = $_POST['name']; $headers = "From: $from"; if(($to == "")||($subject == "")||($message == "")||($from == "")){ echo "Please fill in all the fields"; $form = true; } else{ if(mail($to,$subject,$message,$headers)) { //echo "Thank you for your interest, your e-mail was sent."; echo "Thank you for your interest, your e-mail was sent."; $form = false; } } } if($form == true){ print '<form action="" method=post name=form1 id=form1> <table width="100%" border="0" cellspacing="1" cellpadding="3"> <tr> <td width="16%"><span class="style108">Subject</span></td> <td width="2%"><span class="style104">:</span></td> <td width="82%"><input name="subject" type="text" id="subject" size="50" /></td> </tr> <tr> <td><span class="style108">Message</span></td> <td><span class="style104">:</span></td> <td><textarea name="detail" cols="50" rows="4" id="detail"></textarea></td> </tr> <tr> <td><span class="style108">Name</span></td> <td><span class="style104">:</span></td> <td><input name="name" type="text" id="name" size="50" /></td> </tr> <tr> <td><span class="style108">Email</span></td> <td><span class="style104">:</span></td> <td><input name="customer_mail" type="text" id="customer_mail" size="50" /></td> </tr> <tr> <td> </td> <td> </td> <td><input type="submit" name="Submit" value="Submit" /> <input type="reset" name="Submit2" value="Reset" /></td> </tr> </table> </form>'; } ?> Quote Link to comment Share on other sites More sharing options...
HNX Posted December 14, 2007 Author Share Posted December 14, 2007 no u didnt get it the previous code si working FINe, the only problem is, well look this is the form: Subject: Message: Name: Email: when i filll all the above fields and submit i receive all of them except! the EMAIL!!! so maybe im missing a tag somewhere in the code Quote Link to comment Share on other sites More sharing options...
phpSensei Posted December 14, 2007 Share Posted December 14, 2007 when you say EMAIL, you the "TO:" part right? Other than that, there is no EMAIL part in the code. Quote Link to comment Share on other sites More sharing options...
HNX Posted December 14, 2007 Author Share Posted December 14, 2007 look at the picture, this is what im talking about Lol i dont receive the email of who ever submits my form :s [attachment deleted by admin] Quote Link to comment Share on other sites More sharing options...
phpSensei Posted December 14, 2007 Share Posted December 14, 2007 look at the picture, this is what im talking about Lol i dont receive the email of who ever submits my form :s OHHHHHHH, whats the name of the EMAIL field? I am sure its not called $from = $_POST['name']; Quote Link to comment Share on other sites More sharing options...
HNX Posted December 14, 2007 Author Share Posted December 14, 2007 euh i dont know but i think we didnt call it anything....so maybe thats why its not retrieving the information Quote Link to comment Share on other sites More sharing options...
phpSensei Posted December 14, 2007 Share Posted December 14, 2007 Lol, why didnt I just look at the form Here is the complete script, this will work. <?php $form = true; if(isset($_POST['Submit'])){ $to = "info@growth-flexvpro.net"; $subject = $_POST['subject']; $message = $_POST['detail']; $from = $_POST['customer_mail']; $headers = "From: $from"; if(($to == "")||($subject == "")||($message == "")||($from == "")){ echo "Please fill in all the fields"; $form = true; } else{ if(mail($to,$subject,$message,$headers)) { //echo "Thank you for your interest, your e-mail was sent."; echo "Thank you for your interest, your e-mail was sent."; $form = false; } } } if($form == true){ print '<form action="" method=post name=form1 id=form1> <table width="100%" border="0" cellspacing="1" cellpadding="3"> <tr> <td width="16%"><span class="style108">Subject</span></td> <td width="2%"><span class="style104">:</span></td> <td width="82%"><input name="subject" type="text" id="subject" size="50" /></td> </tr> <tr> <td><span class="style108">Message</span></td> <td><span class="style104">:</span></td> <td><textarea name="detail" cols="50" rows="4" id="detail"></textarea></td> </tr> <tr> <td><span class="style108">Name</span></td> <td><span class="style104">:</span></td> <td><input name="name" type="text" id="name" size="50" /></td> </tr> <tr> <td><span class="style108">Email</span></td> <td><span class="style104">:</span></td> <td><input name="customer_mail" type="text" id="customer_mail" size="50" /></td> </tr> <tr> <td> </td> <td> </td> <td><input type="submit" name="Submit" value="Submit" /> <input type="reset" name="Submit2" value="Reset" /></td> </tr> </table> </form>'; } ?> Quote Link to comment Share on other sites More sharing options...
HNX Posted December 15, 2007 Author Share Posted December 15, 2007 euh what did u change?? old $form = true; if(isset($_POST['Submit'])){ $to = "my email"; $subject = $_POST['subject']; $message = $_POST['detail']; $from = $_POST['name']; $headers = "From: $from"; if(($to == "")||($subject == "")||($message == "")||($from == "")){ new $form = true; if(isset($_POST['Submit'])){ $to = "my email"; $subject = $_POST['subject']; $message = $_POST['detail']; $from = $_POST['customer_mail']; $headers = "From: $from"; if(($to == "")||($subject == "")||($message == "")||($from == "")){ Quote Link to comment Share on other sites More sharing options...
phpSensei Posted December 15, 2007 Share Posted December 15, 2007 I changed the $form = $_POST['name']; to $form = $_POST['customer_mail']; Quote Link to comment Share on other sites More sharing options...
HNX Posted December 15, 2007 Author Share Posted December 15, 2007 euh ...it doeesnt work Quote Link to comment Share on other sites More sharing options...
HNX Posted December 15, 2007 Author Share Posted December 15, 2007 ook this is the top codings: <?php $form = true; if(isset($_POST['Submit'])){ $to = "my email"; $subject = $_POST['subject']; $message = $_POST['detail']; $from = $_POST['customer_mail']; $headers = "From: $from"; if(($to == "")||($subject == "")||($message == "")||($from == "")){ echo "Please fill in all the fields"; $form = true; } else{ if(mail($to,$subject,$message,$headers)) { //echo "Thank you for your interest, your e-mail was sent."; echo "Thank you for your interest, your e-mail was sent."; $form = false; now im receiving the email but the guys name.... Quote Link to comment Share on other sites More sharing options...
phpSensei Posted December 15, 2007 Share Posted December 15, 2007 he should include his name in the Email, or you can change the Email field to NAME. Quote Link to comment Share on other sites More sharing options...
HNX Posted December 15, 2007 Author Share Posted December 15, 2007 then what about the name field?? if i change the name to email, what am i suppos to do with name!!:| i need name and email both :s Quote Link to comment Share on other sites More sharing options...
phpSensei Posted December 15, 2007 Share Posted December 15, 2007 try this <?php $form = true; if(isset($_POST['Submit'])){ $to = "info@growth-flexvpro.net"; $subject = $_POST['subject']; $message = $_POST['detail']; $from = $_POST['customer_mail']; $headers = "From: $from"; if(($to == "")||($subject == "")||($message == "")||($from == "")){ echo "Please fill in all the fields"; $form = true; } else{ if(mail($to,$subject, 'Name:'.$_POST['name'].'<br><br>'. $message,$headers)) { //echo "Thank you for your interest, your e-mail was sent."; echo "Thank you for your interest, your e-mail was sent."; $form = false; } } } if($form == true){ print '<form action="" method=post name=form1 id=form1> <table width="100%" border="0" cellspacing="1" cellpadding="3"> <tr> <td width="16%"><span class="style108">Subject</span></td> <td width="2%"><span class="style104">:</span></td> <td width="82%"><input name="subject" type="text" id="subject" size="50" /></td> </tr> <tr> <td><span class="style108">Message</span></td> <td><span class="style104">:</span></td> <td><textarea name="detail" cols="50" rows="4" id="detail"></textarea></td> </tr> <tr> <td><span class="style108">Name</span></td> <td><span class="style104">:</span></td> <td><input name="name" type="text" id="name" size="50" /></td> </tr> <tr> <td><span class="style108">Email</span></td> <td><span class="style104">:</span></td> <td><input name="customer_mail" type="text" id="customer_mail" size="50" /></td> </tr> <tr> <td> </td> <td> </td> <td><input type="submit" name="Submit" value="Submit" /> <input type="reset" name="Submit2" value="Reset" /></td> </tr> </table> </form>'; } ?> Quote Link to comment Share on other sites More sharing options...
HNX Posted December 15, 2007 Author Share Posted December 15, 2007 aight this is what it gives me so id like the name to be somewhere else Lol [attachment deleted by admin] Quote Link to comment Share on other sites More sharing options...
phpSensei Posted December 15, 2007 Share Posted December 15, 2007 try <?php $form = true; if(isset($_POST['Submit'])){ $to = "info@growth-flexvpro.net"; $subject = $_POST['subject']; $message = nl2br($_POST['detail']); $from = $_POST['customer_mail']; $headers = "From: $from"; if(($to == "")||($subject == "")||($message == "")||($from == "")){ echo "Please fill in all the fields"; $form = true; } else{ if(mail($to,$subject, 'Name: '.$_POST['name'].'\n\n\n'. $message,$headers)) { //echo "Thank you for your interest, your e-mail was sent."; echo "Thank you for your interest, your e-mail was sent."; $form = false; } } } if($form == true){ print '<form action="" method=post name=form1 id=form1> <table width="100%" border="0" cellspacing="1" cellpadding="3"> <tr> <td width="16%"><span class="style108">Subject</span></td> <td width="2%"><span class="style104">:</span></td> <td width="82%"><input name="subject" type="text" id="subject" size="50" /></td> </tr> <tr> <td><span class="style108">Message</span></td> <td><span class="style104">:</span></td> <td><textarea name="detail" cols="50" rows="4" id="detail"></textarea></td> </tr> <tr> <td><span class="style108">Name</span></td> <td><span class="style104">:</span></td> <td><input name="name" type="text" id="name" size="50" /></td> </tr> <tr> <td><span class="style108">Email</span></td> <td><span class="style104">:</span></td> <td><input name="customer_mail" type="text" id="customer_mail" size="50" /></td> </tr> <tr> <td> </td> <td> </td> <td><input type="submit" name="Submit" value="Submit" /> <input type="reset" name="Submit2" value="Reset" /></td> </tr> </table> </form>'; } ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.