jonnyroboto Posted November 6, 2009 Share Posted November 6, 2009 I have a form that I've built for a client. Real simple form with name, email, phone, other, and comments text fields. I also have 8 check boxes on there too. When I send myself a test email, it is styled the way I'd like, but the text fields are not returning to the email, only the check boxes. Next to name in the email it's blank. What could be a miss? Also, when I submit the form I'd like the Thank You page to open in a new window about 500px square with no scrolls, status, or resize. Thank you <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <link href="css/prosweep.css" rel="stylesheet" type="text/css" /> <link href="css/globalReset.css" rel="stylesheet" type="text/css" /> </head> <body> <?php echo ' <div id="header"> <div id="header_image"> <img src="../images/header.jpg" style="margin: 0 auto;" /> </div><!-- end #header_image --> </div><!-- end #header --> <div id="nav_top"> <div id="nav_top_container"> <ul> <li><a href="#">home</a></li> <li><a href="#">Services</a></li> <li><a href="#">Areas Serviced</a></li> <li><a class="selected" href="#">Contact Us</a></li> <li><a href="#">faq</a></li> <li><a href="#">links</a></li> <li><a href="#">gallery</a></li> </ul> </div><!-- end #nav_top --> </div><!-- end #nav_top_container --> <div id="container"> <div id="nav_main"> <img src="../images/contactInfo.jpg" /> </div> <div id="content"> <h1 class="content">Contact Us</h1> <form id="form" action="processContact.php" method="post" target="foo" onsubmit="window.open()"> <div align="center"> <table> <tr> <td>* Name:</td> <td><input type="text" name="name" size="30" /></td> </tr> <tr> <td>* Email:</td> <td><input type="text" name="email" size="30" /></td> </tr> <tr> <td>* Phone:</td> <td><input type="text" name="phone" size="30" /></td> </tr> </table> </div> <br /> <div align="center"> <table> <tr> <td colspan="2" align="center">* What can we help you with?</td> </tr> <tr> <td><input type="checkbox" name="box1" value="Street Sweeping" /></td><td>Street Sweeping</td> </tr> <tr> <td><input type="checkbox" name="box2" value="Parking Lot Sweeping" /></td><td>Parking Lot Sweeping</td> </tr> <tr> <td><input type="checkbox" name="box3" value="Facility Maintenance" /></td><td>Facility Maintenance</td> </tr> <tr> <td><input type="checkbox" name="box4" value="Commercial Landscape Maintenance" /></td><td>Commercial Landscape Maintenance</td> </tr> <tr> <td><input type="checkbox" name="box5" value="Hot Water Pressure Washing" /></td><td>Hot Water Pressure Washing</td> </tr> <tr> <td><input type="checkbox" name="box6" value="Roll-off Container Rental" /></td><td>Roll-off Container Rental</td> </tr> <tr> <td><input type="checkbox" name="box7" value="Hauling and Debris Removal" /></td><td>Hauling and Debris Removal</td> </tr> <tr> <td><input type="checkbox" name="box8" value="Other Information" /></td><td>Other</td> </tr> <tr> <td colspan="2" align="center"><input type="text" name="other" size="30" /></td> </tr> </table> <br /> </div> <font size="1"><i>* Required Fields</i></font><br /> <br /> <h2>Comments<br /><br /></h2> <div align="center"> <textarea name="feedback" rows="6" cols="30"></textarea> </div> <hr /> <br /><input type="submit" /><br /><br /> </form> </div> </div><!-- end #container --> <div id="footer"> <div id="nav_bottom"> <ul> <li><a href="#">home</a></li> <li><a href="#">Services</a></li> <li><a href="#">Areas Serviced</a></li> <li><a class="selected" href="#">Contact Us</a></li> <li><a href="#">faq</a></li> <li><a href="#">links</a></li> <li><a href="#">gallery</a></li> </ul> </div> </div><!-- end #footer --> '; ?> </body> </html> <?php /* Subject and Email Variables */ $emailSubject = 'Company Contact Form'; $webMaster = '[email protected]'; /* Gathering Data Variables */ $nameField = $_POST['name']; $emailField = $_POST['email']; $phoneField = $_POST['phone']; $box1 = $_POST['box1']; $box2 = $_POST['box2']; $box3 = $_POST['box3']; $box4 = $_POST['box4']; $box5 = $_POST['box5']; $box6 = $_POST['box6']; $box7 = $_POST['box7']; $box8 = $_POST['box8']; $otherField = $_POST['other']; $feedbackField = $_POST['feedback']; $body = <<<EOD <br><hr><br> Name: $name <br> <br> Phone: $phone <br> <br> Email: $email <br> <br> Site Rating: $rating <br> <br> Info Needed: $box1, $box2, $box3, $box4, $box5, $box6, $box7, $box8 <br> <br> Other Information Requested: $other <br> <br> Comments: $feedback <br> EOD; $headers = "From: $email\r\n"; $headers .= "Content-type: text/html\r\n"; $success = mail($webMaster, $emailSubject, $body, $headers); /* Results Rendered HTML */ $theResults = <<<EOD <html> <head> <title>Thank you!</title> <style type="text/css"> h1 { color: #ffffff; text-align: center; } h2 { color: #ffffff; text-align: center; } h3 { color: #ffffff; text-align: center; } a:link { color: #330033; text-decoration: none; } a:visited { color: #000033; text-decoration: none; } a:hover { color: #663399; text-decoration: none; } </style> </head> <body bgcolor="#9999cc"> <form> <h1>Thank you.</h1><br> <h2>An email has been sent to us and we will be contacting you soon.</h2> <h3>Thank you again for visiting wdwvip.com You may click below to close this window.</h3> <div align="center"> <input type="button" value="Close Window" onClick="window.close()"></div> </form> <div align="center"> <a href="javascript:window.close()">Close Window</a> </div> </body> </html> EOD; echo "$theResults"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/180607-my-form-returns-check-boxes-but-not-field-data/ Share on other sites More sharing options...
cags Posted November 7, 2009 Share Posted November 7, 2009 $nameField = $_POST['name']; ... Name: $name <br> Spot the deliberate mistake... Quote Link to comment https://forums.phpfreaks.com/topic/180607-my-form-returns-check-boxes-but-not-field-data/#findComment-953089 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.