Jump to content

Form To Email


Philwn

Recommended Posts

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

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.