Philwn Posted January 16, 2009 Share Posted January 16, 2009 I posted a day or two ago about my form to email script, I have a form with alot of drop down boxes and only wanted the boxes which had a value more than 0 to be sent in the e-mail. My problem was solved almost instantly but I have forgotten about the text fields at the top where they enter their name and account number. because of the following code I only recieve the drop down boxes more than 0 but dont recieve the important info: <script language="php"> $email = $HTTP_POST_VARS[email]; $mailto = "[email protected]"; $mailsubj = "Form submission"; $mailhead = "From: $email\n"; reset ($HTTP_POST_VARS); $mailbody = "Values submitted from web site form:\n"; while (list ($key, $val) = each ($HTTP_POST_VARS)) { if ($val != 0) $mailbody .= "$key : $val\n"; } if (!eregi("\n",$HTTP_POST_VARS[email])) { mail($mailto, $mailsubj, $mailbody, $mailhead); } </script> Link to comment https://forums.phpfreaks.com/topic/141059-form-to-email/ Share on other sites More sharing options...
Philwn Posted January 16, 2009 Author Share Posted January 16, 2009 print $HTTP_POST_VARS[name]; isnt working Link to comment https://forums.phpfreaks.com/topic/141059-form-to-email/#findComment-738266 Share on other sites More sharing options...
Philwn Posted January 16, 2009 Author Share Posted January 16, 2009 Think im getting close now <script language="php"> $email = $HTTP_POST_VARS[email]; $mailto = "my email"; $mailsubj = "Form submission"; $mailhead = "From: $email\n"; $name = $_REQUEST['name'] ; $shop = $_REQUEST['shop'] ; reset ($HTTP_POST_VARS); $mailbody = "Values submitted from web site form:\n"; $name; $shop; while (list ($key, $val) = each ($HTTP_POST_VARS)) { if ($val != 0) $mailbody .= "$key : $val\n"; } if (!eregi("\n",$HTTP_POST_VARS[email])) { mail($mailto, $mailsubj, $mailbody, $mailhead); } </script> Link to comment https://forums.phpfreaks.com/topic/141059-form-to-email/#findComment-738269 Share on other sites More sharing options...
Philwn Posted January 16, 2009 Author Share Posted January 16, 2009 ok so now im getting close, i can get it to send me the shop name but the customers name does not work? <script language="php"> $email = $HTTP_POST_VARS['email']; $mailto = "blank"; $mailsubj = "Form submission"; $mailhead = "From: $email\n"; $name = $HTTP_POST_VARS['name']; $shop = $HTTP_POST_VARS['shop']; reset ($HTTP_POST_VARS); $mailbody = "Values submitted from web site form:\n"; $mailbody .= "$name\n"; $mailbody .= "$shop\n"; while (list ($key, $val) = each ($HTTP_POST_VARS)) { if ($val != 0) $mailbody .= "$key : $val\n"; } if (!eregi("\n",$HTTP_POST_VARS['email'])) { mail($mailto, $mailsubj, $mailbody, $mailhead); } </script> Link to comment https://forums.phpfreaks.com/topic/141059-form-to-email/#findComment-738282 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.