phpSensei Posted December 13, 2007 Share Posted December 13, 2007 Your welcome, and also thank PHPquestioner, he just answered your question for me lol. Quote Link to comment Share on other sites More sharing options...
HNX Posted December 13, 2007 Author Share Posted December 13, 2007 <?php if(isset($_POST['Submit'])){ $to = "YOUR HOTMAIL ADDRESS"; $subject = $_POST['subject']; $message = $_POST['detail']; $from = $_POST['name']; $headers = "From: $from"; if(mail($to,$subject,$message,$headers)) { //echo "Thank you for your interest, your e-mail was sent."; header("Location: success.php"); // change "sucess.php" to the page you want them to be redirected to; if email is submitted successfully. exit; } } 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>'; ?> does it have to be a php file?? and when u say "change "sucess.php" to the page you want them to be redirected to; if email is submitted successfully." thats what i should write?? so does it mean i can remove this from the code afterwards??? Quote Link to comment Share on other sites More sharing options...
phpSensei Posted December 13, 2007 Share Posted December 13, 2007 <?php if(isset($_POST['Submit'])){ $to = "YOUR HOTMAIL ADDRESS"; $subject = $_POST['subject']; $message = $_POST['detail']; $from = $_POST['name']; $headers = "From: $from"; if(mail($to,$subject,$message,$headers)) { //echo "Thank you for your interest, your e-mail was sent."; header("Location: success.php"); // change "sucess.php" to the page you want them to be redirected to; if email is submitted successfully. exit; } } 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>'; ?> does it have to be a php file?? and when u say "change "sucess.php" to the page you want them to be redirected to; if email is submitted successfully." thats what i should right/?? so does it mean i can remove this from the code afterwards??? LOL, Everytime we change the script you have to replace the old one with this one. Change the part where it says success.php to the page you want the users to be redirected. Quote Link to comment Share on other sites More sharing options...
HNX Posted December 13, 2007 Author Share Posted December 13, 2007 well did u see the page i sent?? i mean the link ??? thats exactly what i want so all i have to do is make the script go to the contact us page/??/ and the script will tell the dude itself that ur message was sent on the same page right?? check the site i gave u (http://www.elico.ca/main.cfm?p=40&l=fr) Quote Link to comment Share on other sites More sharing options...
phpSensei Posted December 13, 2007 Share Posted December 13, 2007 well did u see the page i sent?? i mean the link ??? thats exactly what i want so all i have to do is make the script go to the contact us page/??/ and the script will tell the dude itself that ur message was sent on the same page right?? check the site i gave u (http://www.elico.ca/main.cfm?p=40&l=fr) If thats what you want, then you have to send the user to another page, validate the data sent, and give him a message if the form was sent, or redirect if there was an error. Just use the script we gave you. Quote Link to comment Share on other sites More sharing options...
phpSensei Posted December 13, 2007 Share Posted December 13, 2007 Try this <?php if(isset($_POST['Submit'])){ $to = "YOUR HOTMAIL ADDRESS"; $subject = $_POST['subject']; $message = $_POST['detail']; $from = $_POST['name']; $headers = "From: $from"; if(($to == "")||($subject == "")||($message == "")||($from == "")){ echo "Please fill in all the fields"; } else{ if(mail($to,$subject,$message,$headers)) { //echo "Thank you for your interest, your e-mail was sent."; header("Location: success.php"); // change "sucess.php" to the page you want them to be redirected to; if email is submitted successfully. exit; } } } 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>'; ?> Quote Link to comment Share on other sites More sharing options...
phpQuestioner Posted December 13, 2007 Share Posted December 13, 2007 you will also need to add an error variable below each field to do this and you will need to validate each of your form variables seperately. Quote Link to comment Share on other sites More sharing options...
HNX Posted December 13, 2007 Author Share Posted December 13, 2007 ok first let me undertand how to make the page "success.php" so what i need to do is copy my contact page and remove the form and write instead " your msg was sent" right? @phpquestioner : euh i dont know how to do that... do u have any suggestions for where to learn php Quote Link to comment Share on other sites More sharing options...
phpQuestioner Posted December 13, 2007 Share Posted December 13, 2007 @phpquestioner : euh i dont know how to do that... do u have any suggestions for where to learn php yeah - try your local books store - that's a start - go out and get you a php book for beginners - also search google for some php beginner tutorial. you can also learn from other people's threads on this and other php forums. Quote Link to comment Share on other sites More sharing options...
HNX Posted December 13, 2007 Author Share Posted December 13, 2007 @phpquestioner thanks Lol @sensei yo dude so can u tell me whats the answer to my quesion? Quote Link to comment Share on other sites More sharing options...
phpSensei Posted December 13, 2007 Share Posted December 13, 2007 @phpquestioner thanks Lol @sensei yo dude so can u tell me whats the answer to my quesion? You don't have to use HEADER("LOCATION: success.php"); you can just use die("Your message was sent. Thankyou."); Quote Link to comment Share on other sites More sharing options...
HNX Posted December 13, 2007 Author Share Posted December 13, 2007 huh will that do the work??? btw my question was as follows ok first let me undertand how to make the page "success.php" so what i need to do is copy my contact page and remove the form and write instead " your msg was sent" right? i asked i have to make the file but then ur tellin me to replace somethin?!! im puzzled!!:| Quote Link to comment Share on other sites More sharing options...
phpSensei Posted December 13, 2007 Share Posted December 13, 2007 huh will that do the work??? btw my question was as follows ok first let me undertand how to make the page "success.php" so what i need to do is copy my contact page and remove the form and write instead " your msg was sent" right? i asked i have to make the file but then ur tellin me to replace somethin?!! im puzzled!!:| I know what you ment, use this script <?php if(isset($_POST['Submit'])){ $to = "YOUR HOTMAIL ADDRESS"; $subject = $_POST['subject']; $message = $_POST['detail']; $from = $_POST['name']; $headers = "From: $from"; if(($to == "")||($subject == "")||($message == "")||($from == "")){ echo "Please fill in all the fields"; } else{ if(mail($to,$subject,$message,$headers)) { //echo "Thank you for your interest, your e-mail was sent."; die("Your message was sent to ".$to." successfuly"); // change "sucess.php" to the page you want them to be redirected to; if email is submitted successfully. exit; } } } 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>'; ?> Quote Link to comment Share on other sites More sharing options...
HNX Posted December 13, 2007 Author Share Posted December 13, 2007 ok i replaced send_mail by this but at one point ur sayin "sucess.php" to the page...i dont get it Lol (ur sayin that in the script) Quote Link to comment Share on other sites More sharing options...
phpSensei Posted December 13, 2007 Share Posted December 13, 2007 ok i replaced send_mail by this but at one point ur sayin "sucess.php" to the page...i dont get it Lol (ur sayin that in the script) O lol, just delete that comment, its nothing, just ignore it and tell me how it goes. Quote Link to comment Share on other sites More sharing options...
HNX Posted December 13, 2007 Author Share Posted December 13, 2007 ok it says : Your message was sent to someone@hotmail.com successfuly i dont want the people to see my email :s oh and i delete this part // change "sucess.php" to the page you want them to be redirected to; if email is submitted successfully. Quote Link to comment Share on other sites More sharing options...
phpSensei Posted December 13, 2007 Share Posted December 13, 2007 ok it says : Your message was sent to someone@hotmail.com successfuly i dont want the people to see my email :s Try this then <?php if(isset($_POST['Submit'])){ $to = "YOUR HOTMAIL ADDRESS"; $subject = $_POST['subject']; $message = $_POST['detail']; $from = $_POST['name']; $headers = "From: $from"; if(($to == "")||($subject == "")||($message == "")||($from == "")){ echo "Please fill in all the fields"; } else{ if(mail($to,$subject,$message,$headers)) { //echo "Thank you for your interest, your e-mail was sent."; die("Thank you for your interest, your e-mail was sent."); } } } 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>'; ?> Quote Link to comment Share on other sites More sharing options...
HNX Posted December 13, 2007 Author Share Posted December 13, 2007 blank page with this message on top: Thank you for your interest, your e-mail was sent. Quote Link to comment Share on other sites More sharing options...
phpSensei Posted December 13, 2007 Share Posted December 13, 2007 blank page with this message on top: Thank you for your interest, your e-mail was sent. So that does it for you? ??? Quote Link to comment Share on other sites More sharing options...
HNX Posted December 13, 2007 Author Share Posted December 13, 2007 euh thats the same thing as before....remember the website i showed?? thats wht i need, i dont want it to go to a blank page but instead to load on the same page....if iu understand what i mean? hopelessly Lol, HNX Quote Link to comment Share on other sites More sharing options...
phpSensei Posted December 13, 2007 Share Posted December 13, 2007 euh thats the same thing as before....remember the website i showed?? thats wht i need, i dont want it to go to a blank page but instead to load on the same page....if iu understand what i mean? hopelessly Lol, HNX o lol, well we already gave you a script that does that. try <?php if(isset($_POST['Submit'])){ $to = "YOUR HOTMAIL ADDRESS"; $subject = $_POST['subject']; $message = $_POST['detail']; $from = $_POST['name']; $headers = "From: $from"; if(($to == "")||($subject == "")||($message == "")||($from == "")){ echo "Please fill in all the fields"; } 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."; } } } 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>'; </table>'; </form>'; ?> Quote Link to comment Share on other sites More sharing options...
HNX Posted December 13, 2007 Author Share Posted December 13, 2007 it says : Parse error: syntax error, unexpected '<' in /home2/growthf/public_html/send_mail.php on line 52 Quote Link to comment Share on other sites More sharing options...
phpSensei Posted December 13, 2007 Share Posted December 13, 2007 my bad.. try <?php if(isset($_POST['Submit'])){ $to = "YOUR HOTMAIL ADDRESS"; $subject = $_POST['subject']; $message = $_POST['detail']; $from = $_POST['name']; $headers = "From: $from"; if(($to == "")||($subject == "")||($message == "")||($from == "")){ echo "Please fill in all the fields"; } 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."; } } } 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>'; ?> Quote Link to comment Share on other sites More sharing options...
HNX Posted December 13, 2007 Author Share Posted December 13, 2007 ok this is what it gives me [attachment deleted by admin] Quote Link to comment Share on other sites More sharing options...
HNX Posted December 13, 2007 Author Share Posted December 13, 2007 euh joey are you still online??? 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.