December 5, 200817 yr Hi my e-mail form has decided to stop working and I am not sure why it has been working in the past and I have not changed any of the code. I have the contact page and also a php page. Here is the code. CODE For contact form on page contact.html <table class="center" cellspacing="10px"> <tr> <td>Email:</td> <td>howlomogo@hotmail (.) com</td> </tr> </table> <form action="contactprocess.php" method="post" class="conbox"> <table class="con" cellspacing="10px"> <tr> <td><div align="right">Name: </div></td> <td><input class="con" name="name" type="text" id="name" maxlength="40" /></td> </tr> <tr> <td><div align="right">Email: </div></td> <td><input class="con" name="email" type="text" id="email" maxlength="40" /></td> </tr> <tr> <td><div align="right">Message: </div></td> <td><textarea class="con" name="message" id="message" cols="35" rows="7"></textarea></td> </tr> <tr> <td><input type="submit" name="Send" value="Send" id="Send" /></td> <td><input type="reset" name="Clear" value="Clear" id="Clear" /></td> </tr> </table> </form> Code with php script contactprocess.php <title>Contact</title><?php /* Variables */ $emailSubject = 'Website Message!!'; $webMaster = 'howlomogo@hotmail.com';s /* Gathering dta variables */ $nameField = $_POST['name']; $emailField = $_POST['email']; $messageField = $_POST['message']; /* this EOP is what will be displayed in the email */ $body = <<<EOD <br><br> Email:$emailField<br> Name:$nameField<br> Message:$messageField<br> EOD; $headers = "From: $emailField\r\n"; $headers .= "Content-type: text/html\r\n"; $success = mail($webMaster, $emailSubject, $body, $headers); /*results rendered as html */ $theResults = <<<EOD <!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> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> <title>Contact</title> <link href="stylesheet.css" rel="stylesheet" type="text/css" /> <style type="text/css"> <!-- body { background-color: #000000; } --> </style> <script type="text/javascript"> var timeout = 500; var closetimer = 0; var ddmenuitem = 0; function mopen(id) { mcancelclosetime(); if(ddmenuitem) ddmenuitem.style.visibility = 'hidden'; ddmenuitem = document.getElementById(id); ddmenuitem.style.visibility = 'visible'; } function mclose() { if(ddmenuitem) ddmenuitem.style.visibility = 'hidden'; } function mclosetime() { closetimer = window.setTimeout(mclose, timeout); } function mcancelclosetime() { if(closetimer) { window.clearTimeout(closetimer); closetimer = null; } } document.onclick = mclose; </script> </head> <body> <div id="body"> <div id="header"></div> <div id="middle"> <div id="leftmiddle"> <ul id="sddm"> <li><a href="index.html">Home</a></li> <li><a href="about.html" onmouseover="mopen('m2')" onmouseout="mclosetime()">About</a> <div id="m2" onmouseover="mcancelclosetime()" onmouseout="mclosetime()"> <a href="about.html">About Me</a> <a href="http://mdpdesigns.blogspot.com">Blog</a> </div> </li> <li><a href="illustration.html" onmouseover="mopen('m3')" onmouseout="mclosetime()">Portfolio</a> <div id="m3" onmouseover="mcancelclosetime()" onmouseout="mclosetime()"> <a href="illustration.html">Illustration</a> <a href="photography.html">Photography</a> <a href="interactive.html">Interactive</a> <a href="webdesign.html">Web Design</a> </div> </li> <li><a href="contact.html">Contact</a></li> </ul> <div id="bleft"></div> </div> <div id="rightmiddle"> <br /><br /><br /><br /> <p class="htext">Thank you for your message I will get back to you ASAP... <br /><br /><br /> Matt </p> </div> </div> <div id="footer"> <p> <a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0 Transitional" height="31" width="88" /></a> </p> <p><a href="index.html">Home</a> | <a href="about.html">About</a> | <a href="webdesign.html">Web Design</a> | <a href="interactive.html">Interactive</a> | <a href="photography.html">Photography</a> | <a href="illustration.html">Illustration</a> | <a href="http://mdpdesigns.blogspot.com/">Blog</a> | <a href="contact.html">Contact</a><br /> © 2008 Matthew Pilcher </p> </div> </div> </body> </html> EOD; echo "$theResults"; ?> It shows this error Parse error: syntax error, unexpected T_VARIABLE in /web/guide/abbaplus/public_html/contactprocess.php on line 10 If you have any ideas why this isnt working please let me know Thanks Matt
December 5, 200817 yr this is your problem... i take it you save by doing Ctrl + S $webMaster = 'howlomogo@hotmail.com';s corrected code below <title>Contact</title><?php /* Variables */ $emailSubject = 'Website Message!!'; $webMaster = 'howlomogo@hotmail.com'; /* Gathering dta variables */ $nameField = $_POST['name']; $emailField = $_POST['email']; $messageField = $_POST['message']; /* this EOP is what will be displayed in the email */ $body = <<<EOD <br><br> Email:$emailField<br> Name:$nameField<br> Message:$messageField<br> EOD; $headers = "From: $emailField\r\n"; $headers .= "Content-type: text/html\r\n"; $success = mail($webMaster, $emailSubject, $body, $headers); /*results rendered as html */ $theResults = <<<EOD <!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> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> <title>Contact</title> <link href="stylesheet.css" rel="stylesheet" type="text/css" /> <style type="text/css"> <!-- body { background-color: #000000; } --> </style> <script type="text/javascript"> var timeout = 500; var closetimer = 0; var ddmenuitem = 0; function mopen(id) { mcancelclosetime(); if(ddmenuitem) ddmenuitem.style.visibility = 'hidden'; ddmenuitem = document.getElementById(id); ddmenuitem.style.visibility = 'visible'; } function mclose() { if(ddmenuitem) ddmenuitem.style.visibility = 'hidden'; } function mclosetime() { closetimer = window.setTimeout(mclose, timeout); } function mcancelclosetime() { if(closetimer) { window.clearTimeout(closetimer); closetimer = null; } } document.onclick = mclose; </script> </head> <body> <div id="body"> <div id="header"></div> <div id="middle"> <div id="leftmiddle"> <ul id="sddm"> <li><a href="index.html">Home</a></li> <li><a href="about.html" onmouseover="mopen('m2')" onmouseout="mclosetime()">About</a> <div id="m2" onmouseover="mcancelclosetime()" onmouseout="mclosetime()"> <a href="about.html">About Me</a> <a href="http://mdpdesigns.blogspot.com">Blog</a> </div> </li> <li><a href="illustration.html" onmouseover="mopen('m3')" onmouseout="mclosetime()">Portfolio</a> <div id="m3" onmouseover="mcancelclosetime()" onmouseout="mclosetime()"> <a href="illustration.html">Illustration</a> <a href="photography.html">Photography</a> <a href="interactive.html">Interactive</a> <a href="webdesign.html">Web Design</a> </div> </li> <li><a href="contact.html">Contact</a></li> </ul> <div id="bleft"></div> </div> <div id="rightmiddle"> <br /><br /><br /><br /> <p class="htext">Thank you for your message I will get back to you ASAP... <br /><br /><br /> Matt smile.gif</p> </div> </div> <div id="footer"> <p> <a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0 Transitional" height="31" width="88" /></a> </p> <p><a href="index.html">Home</a> | <a href="about.html">About</a> | <a href="webdesign.html">Web Design</a> | <a href="interactive.html">Interactive</a> | <a href="photography.html">Photography</a> | <a href="illustration.html">Illustration</a> | <a href="http://mdpdesigns.blogspot.com/">Blog</a> | <a href="contact.html">Contact</a><br /> © 2008 Matthew Pilcher </p> </div> </div> </body> </html> EOD; echo "$theResults"; ?>
December 5, 200817 yr Author Wow genius thanks ALOT that has saved me a lot of hours so it was only because I had the ;s there ?
December 5, 200817 yr indeed, its because ; means the end of the this statement so the "s" after it creates a syntax error glad to be of service
December 5, 200817 yr Haha snider I like how you were even able to diagnose how it got there - like a true detective!
December 6, 200817 yr Author The code is working in Firefox and Safari on Mac but is not working on Internet Explorer on windows. I am not sure why but am wondering if it has anything to do with securing the form? there are no error messages, the e-mail just does not come through. Form Code <form action="formprocess.php" method="post"> <p><label for="firstname">First Name</label> <input type="text" id="firstname" name="firstname" /></p> <p><label for="lastname">Last Name</label> <input type="text" id="lastname" name="lastname" /></p> <p><label for="address1">Address 1</label> <input type="text" id="address1" name="address1" /></p> <p><label for="address2">Address 2</label> <input type="text" id="address2" name="address2" /></p> <p><label for="country">Country</label> <input type="text" id="country" name="country" /></p> <p><label for="postcode">Postcode</label> <input type="text" id="postcode" name="postcode" /></p> <p><label for="telephone">Telephone</label> <input type="text" id="telephone" name="telephone" /></p> <p><label for="mobile">Mobile</label> <input type="text" id="mobile" name="mobile" /></p> <p><label for="email">E-mail</label> <input type="text" id="email" name="email" /></p> <p><label for="maxrent">Max Rent (£)</label> <input type="text" id="maxrent" name="maxrent" /></p> <input type="submit" name="Send" value="Send" id="Send" /> <input type="reset" name="Clear" value="Clear" id="Clear" /> </form> FormProcess.PHP Code <title>Contact</title><?php /* Variables */ $emailSubject = 'Website Message!!'; $webMaster = 'howlomogo@hotmail.com'; /* Gathering dta variables */ $firstnameField = $_POST['firstname']; $lastnameField = $_POST['lastname']; $address1Field = $_POST['address1']; $address2Field = $_POST['address2']; $countryField = $_POST['country']; $postcodeField = $_POST['postcode']; $telephoneField = $_POST['telephone']; $mobileField = $_POST['mobile']; $emailField = $_POST['email']; $maxrentField = $_POST['maxrent']; /* this EOP is what will be displayed in the email */ $body = <<<EOD <br /><br /> Name:$firstnameField $lastnameField<br /><br /> Address:<br /> $address1Field<br /> $address2Field<br /> $countryField<br /> $postcodeField<br /><br /> Telephone:$telephoneField<br /><br /> Mobile:$mobileField<br /><br /> Email:$emailField<br /><br /> Max Rent:£$maxrentField EOD; $headers = "From: $emailField\r\n"; $headers .= "Content-type: text/html\r\n"; $success = mail($webMaster, $emailSubject, $body, $headers); /*results rendered as html */ $theResults = <<<EOD <!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> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> <title>ABBA,lettings,Portsmouth,Southsea,Rentals,Properties,To,Let</title> <style type="text/css"> <!-- --> </style> <link rel="stylesheet" type="text/css" href="abba_styles.css" /> </head> <body> HELLO </body> </html> Cheers Matt EOD; echo "$theResults"; ?>
December 6, 200817 yr i made this, seing how so many are having troubles with email contact forms: http://sandbox.sakuiweb.com/contact/
December 6, 200817 yr Author The problem I am having is when I fill the e-mail field in it does not send? I can fill in all the other parts but when I fill in the e-mail field it does not work with Internet explorer or Firefox AHH any ideas? http://www.mdpdesigns.co.uk/abba_lettings/tenant_form.html here is where the form is.
December 6, 200817 yr make sure the global settings are correct (you need to set the number to the field number where the user inputs thier email address)
Create an account or sign in to comment