Zylvyn Posted January 12, 2009 Share Posted January 12, 2009 I'm trying to convert a website away from frontpage extensions, due to the site host no longer supporting them, and I'm trying to use PHP for my forms, to do this. I have a smaller PHP reference manual, with examples, and I was fairly certain that I followed them... except, well... When the email comes through (and it comes through just fine, too) it shows all of the text I have, with none of the variables that should have been passed from the previous form. The form is on a standard HTML page: <form action="list-your-cottage-rental.php" method="post"> <input type="hidden" name="formVer" value="CotW Cottage Rental V1.8.2009"> <table border="1" width="100%" cellpadding="3" bordercolor="#000000" style="border-collapse: collapse"> <tr> <td bgcolor="#FFFFCC"><b>Personal Information</td> </tr> </table> <p><b>Full Name(s):<br> <input type="text" name="strClName" size="40"><br> <br> Telephone Number(s):<br> <input type="text" name="strClPhone" size="40"><br> <br> E-mail Address:<br> <input type="text" name="strClEmail" size="40"><br> <br> Mailing Address:<br> <textarea rows="4" name="strClMailing" cols="30"></textarea></b></p> <input type="submit" value="Submit" name="Submit" class="button"> </form> It's a longer form, but you get the idea... The php page that it sends the information to ... <html> <head> <title>Form Sent</title> <link rel="stylesheet" type="text/css" href="../default.css" /> </head> <body> <?php // require_once('recaptchalib.php'); $toemail='my@emailaddress.com'; $body=" Form: ".$formVer." Client Name: ".$strClName." Client Phone: ".$strClPhone." \n Client Email: $strClEmail \n Client Address: $strClMailing \n"; $extra= 'From: $strClEmail'; $subject = $strClName; $body = wordwrap($body, 70); mail($toemail, $subject, $body, $extra); //Email send ?> **Some HTML letting them know that an email was sent** You'll likely notice that it looks like I changed how it was being put into the email. This was all in hopes of trying to find a working syntax, after some quick googlings of the general idea of my problem. Anyways, the email sends just fine, it's the variables that just aren't there, that concerns me. The email I get looks like this: Form: Client Name: Client Phone: Client Email: Client Address: No variables whatsoever. The form is actually much longer, and so is the php, but I can't get ANY variables to pass through. Am I overlooking something painfully simple, here? Quote Link to comment https://forums.phpfreaks.com/topic/140518-solved-sending-email-variables-not-displaying/ Share on other sites More sharing options...
premiso Posted January 12, 2009 Share Posted January 12, 2009 You need to use $_POST['formfieldname'] to access them. Quote Link to comment https://forums.phpfreaks.com/topic/140518-solved-sending-email-variables-not-displaying/#findComment-735330 Share on other sites More sharing options...
Zylvyn Posted January 12, 2009 Author Share Posted January 12, 2009 Wow... that simple. Strange that this book didn't mention it. Although it is copyright 2003 from when I was in college... has PHP really changed that much since then? Wow... Anyways, tested it out and it's working flawlessly. Thank you very much for your assistance. Quote Link to comment https://forums.phpfreaks.com/topic/140518-solved-sending-email-variables-not-displaying/#findComment-735354 Share on other sites More sharing options...
premiso Posted January 12, 2009 Share Posted January 12, 2009 Wow... that simple. Strange that this book didn't mention it. Although it is copyright 2003 from when I was in college... has PHP really changed that much since then? Wow... Anyways, tested it out and it's working flawlessly. Thank you very much for your assistance. Yes, but this was known since 2002, programmers just cannot write books very well. The issue of register_globals is just really sinking in and being acted on. Quote Link to comment https://forums.phpfreaks.com/topic/140518-solved-sending-email-variables-not-displaying/#findComment-735358 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.