Jump to content

csacton

New Members
  • Posts

    3
  • Joined

  • Last visited

csacton's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi there, I've built a form that should generate an e-mail, but it's not working properly. At first the page wouldn't display at all due to a problem with the EOD tags, that's fixed and I can now see a page, but when I type something in and hit submit, it's just not doing what it's supposed to do. Like I said it's supposed to e-mail me the data and leave the form filled with the data just submitted; it's doing neither. It is however posting the info into the address bar, so something is happening at least. here's a link to the page: http://www.remembertheprojector.com/php/testform.php here's the code: <?php if ($_POST['parse_var'] == "testform"){ $emailtitle = 'New E-mail'; $youremail = 'junk@remembertheprojector.com'; $namefield = $_POST['name']; $emailfield = $_POST['email']; $messagefield = $_POST['message']; $body = <<<EOD <br><hr><br> Name: $namefield <br /> Email: $emailfield <br /> Message: $messagefield <br /> EOD; $headers = "From: $emailfield\r\n"; $headers .= "Content-type: text/html\r\n"; $success = mail("$youremail", "$emailtitle", "$body", "$headers"); $sent = "Thank you!"; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html lang="EN" dir="ltr" xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/xml; charset=utf-8" /> <title>Contact Form</title> </head> <body> <table width="400" border="1" cellpadding="0" align="center"> <tr> <td align="center">Contact me? <br /> <br /> <form id="contactform" name="contactform" methord="post" action="testform.php"> <table width="100%" border="0" cellpadding="3"> <tr> <td width="25%" align="right">Name:</td> <td width="75%"> <label for="name"></lable> <input type="text" name="name" id="name" maxlength="30" size="30" value="<?php print "$namefield"; ?>" /> </td> </tr> <tr> <td width="25%" align="right">Email:</td> <td width="75%"> <label for="email"></lable> <input type="text" name="email" id="email" maxlength="50" size="50" value="<?php print "$emailfield"; ?>" /> </td> </tr> <tr> <td width="25%" align="right">Message:</td> <td width="75%"> <label for="message"></lable> <textarea name="message" id="message" cols="40" rows="5"><?php print "$messagefield"; ?></textarea> </td> </tr> <tr> <td width="25%"></td> <td width="75%" align="right"> <input type="reset" name="reset" id="reset" value="reset" /> <input type="hidden" name="parse_var" id="parse_var" value="testform" /> <input type="submit" name="submit" id="submit" value="submit" /> </td> </tr> <tr> <td width="100%"><?php print "$sent"; ?></td> </tr> </table> </form> </td> </tr> </table> </body> </html> Also attached is a screen shot of the php so you can see how it's tabbed. Thanks for any help.
  2. Hi cyberRobot, Yeah the <br><hr><br> was in the right place, but the closing EOD; wasn't at the beginning of the line, that link you sent got me there. Thanks.
  3. Hi I'm trying to set up my first contact form, but I keep getting this error message: Parse error: syntax error, unexpected end of file in /home/remem539/public_html/php/testform.php on line 85 here's my code, what am I doing wrong? <?php if ($_POST['parse_var'] == "testform"){ $emailtitle = 'New E-mail'; $youremail = 'junk@remembertheprojector.com'; $namefield = $_POST['name']; $emailfield = $_POST['email']; $messagefield = $_POST['message']; $body = <<<EOD <br><hr><br> Name: $namefield <br /> Email: $emailfield <br /> Message: $messagefield <br /> EOD; $headers = "From: $emailfield\r\n"; $headers .= "Content-type: text/html\r\n"; $success = mail("$youremail", "$emailtitle", "$body", "$headers"); $sent = "Thank you!"; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html lang="EN" dir="ltr" xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/xml; charset=utf-8" /> <title>Contact Form</title> </head> <body> <table width="400" border="1" cellpadding="0" align="center"> <tr> <td align="center">Contact me? <br /> <br /> <form id="contactform" name="contactform" methord="post" action="testform.php"> <table width="100%" border="0" cellpadding="3"> <tr> <td width="25%" align="right">Name:</td> <td width="75%"> <label for="name"></lable> <input type="text" name="name" id="name" maxlength="30" size="30" value="<?php print "$namefield"; ?>" /> </td> </tr> <tr> <td width="25%" align="right">Email:</td> <td width="75%"> <label for="email"></lable> <input type="text" name="email" id="email" maxlength="50" size="50" value="<?php print "$emailfield"; ?>" /> </td> </tr> <tr> <td width="25%" align="right">Message:</td> <td width="75%"> <label for="message"></lable> <textarea name="message" id="message" cols="40" rows="5"><?php print "$messagefield"; ?></textarea> </td> </tr> <tr> <td width="25%"></td> <td width="75%" align="right"> <input type="reset" name="reset" id="reset" value="reset" /> <input type="hidden" name="parse_var" id="parse_var" value="testform" /> <input type="submit" name="submit" id="submit" value="submit" /> </td> </tr> <tr> <td width="100%"><?php print "$sent"; ?></td> </tr> </table> </form> </td> </tr> </table> </body> </html>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.