achisholm Posted March 26, 2007 Share Posted March 26, 2007 Hi, I've created an email form on my website by following a guide. I now have two files: contact.htm... <form method=post action="sendmail.php"> <table width="691" border="0" cellpadding="5" cellspacing="0"> <tr> <td width="185" class="white"> <p align="left">your name:</p> </td> <td width="29"> </td> <td width="447"><input name="name" type="text" size="40" /> </td> </tr> <tr> <td class="white"> <p align="left">your email address:</p> </td> <td> </td> <td><input name="email" type="text" size="40" /> </td> </tr> <tr> <tr> <td class="white"> <p align="left">your phone number:</p> </td> <td> </td> <td><input name="phoneNumber" type="text" size="40" /> </td> </tr> <tr> <td valign="top" class="white"><p align="left">best time to contact you?</p> </td> <td valign="top"> </td> <td valign="top"> <select name="bestTime"> <option value="none" selected="selected">please select...</option> <option value="Weekday morning">weekday morning</option> <option value="Weekday afternoon">weekday afternoon</option> <option value="Weekend">weekend</option> <option value="Any time">any time</option> </select> </td> </tr> <tr> <td valign="top" class="white"><p align="left">preferred method of contact?</p> </td> <td valign="top"> </td> <td valign="top"> <select name="contactMethod"> <option value="none">please select...</option> <option value="email">by email</option> <option value="phone">by phone</option> </select> </td> </tr> <tr> <td valign="top" class="white"> <p align="left">please enter your questions<br /> or comments below:</p> </td> <td> </td> <td><textarea name="message" rows="5" cols="50"></textarea> </td> </tr> <tr> <td> </td> <td></td> <td><input name="submit" type="submit" value="Click to Send" /></td> </tr> </table> <div align="right"></div> </form> and Sendmail.php... <?php mail("[email protected]", "From your Contact Form...", $_REQUEST[message], "From: $_REQUEST[email]", "-f".$_REQUEST[email]); header( "Location: http://www.mydomainname.co.uk/thankyou.htm" ); ?> It is actually working fine although when I receive the email it doesn't include all of the information. It only includes the contents of the "message" field. Can you help me so that i will be recieving all the information in the received email? Kind regards, Alistair Link to comment https://forums.phpfreaks.com/topic/44323-solved-e-mail-form/ Share on other sites More sharing options...
Orio Posted March 26, 2007 Share Posted March 26, 2007 <?php $msg = "\"".$_POST['name']."\" wrote:\n" $msg .= $_POST['message']."\n\n\n"; $msg .= "Other details:\n"; $msg .= "Email- ".$_POST['email']."\n"; $msg .= "Phone #- ".$_POST['phoneNumber']."\n"; $msg .= "Best time- ".$_POST['bestTime']."\n"; $msg .= "Contact method- ".$_POST['contactMethod']."\n"; mail("[email protected]", "From your Contact Form...", $msg, "From: ".$_REQUEST['email'], "-f".$_REQUEST[email]); header( "Location: http://www.mydomainname.co.uk/thankyou.htm" ); ?> Orio. Link to comment https://forums.phpfreaks.com/topic/44323-solved-e-mail-form/#findComment-215256 Share on other sites More sharing options...
achisholm Posted March 26, 2007 Author Share Posted March 26, 2007 Hi Orio, i tried putting that in but now it's not working. It puts me to Sendmail.php in the browser and it's just blank instead of redirecting me to the thankyou.htm page and i don't receive any email Link to comment https://forums.phpfreaks.com/topic/44323-solved-e-mail-form/#findComment-215262 Share on other sites More sharing options...
achisholm Posted March 28, 2007 Author Share Posted March 28, 2007 hi, I finally found the reason it wasn't working. A missing semi-colon at the top! There was another problem due to some funny character but i have now got it fully functional. Thanks a lot for helping me out Kind regards, Alistair Link to comment https://forums.phpfreaks.com/topic/44323-solved-e-mail-form/#findComment-216656 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.