Andrew2010 Posted March 23, 2011 Share Posted March 23, 2011 When I press submit on the form, I do receive the email, but the text in the fields don't show up. How do I fix this? Thanks. FORM CODE: <form method="post" id="contacts-form" action="process.php"> <fieldset> <div class="rowElem"> <input type="text" value="Name:" onFocus="if(this.value=='Name:'){this.value=''}" onBlur="if(this.value==''){this.value='Name:'}"> </div> <div class="rowElem"> <input type="email" value="E-mail:" onFocus="if(this.value=='E-mail:'){this.value=''}" onBlur="if(this.value==''){this.value='E-mail:'}"> </div> <textarea onFocus="if(this.value=='Message:'){this.value=''}" onBlur="if(this.value==''){this.value='Message:'}">Message:</textarea> <div class="alignright"><input value="Submit" type="submit" name="submit"></div> </fieldset> </form> PHP CODE: <?php if(isset($_POST['submit'])) { $to = '[email protected]' ; //put your email address on which you want to receive the information $subject = 'Contact Form'; //set the subject of email. $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $message = "<table><tr><td>Name</td><td>".$_POST['Name:']."</td></tr> <tr><td>E-Mail</td><td>".$_POST['E-mail:']."</td></tr> <tr><td>Message</td><td>".$_POST['Message:']."</td> </tr></table>" ; mail($to, $subject, $message, $headers); header('Location: contact.php'); } ?> Link to comment https://forums.phpfreaks.com/topic/231521-form-problem/ Share on other sites More sharing options...
MrXHellboy Posted March 23, 2011 Share Posted March 23, 2011 you forgot the name attribute <input type="text" name="email" /> // get the value of the email field echo $_POST['email']; Link to comment https://forums.phpfreaks.com/topic/231521-form-problem/#findComment-1191417 Share on other sites More sharing options...
Andrew2010 Posted March 23, 2011 Author Share Posted March 23, 2011 Thank you! I am so getting rusty. lol. Appreciated. Link to comment https://forums.phpfreaks.com/topic/231521-form-problem/#findComment-1191419 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.