Form data to email
Posted: Fri Oct 19, 2007 12:06 pm
feyd | Please use
The problem is I don't want the email to display all of the fields in the form. This code loops through everything and spits it all out.
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
I hope someone can help. I'm pretty new to PHP, but I have a form that first inserts values in a mySQL db, and then emails the webmaster with the form contents.Code: Select all
$email = $HTTP_POST_VARS[email];
$mailto = "yourname@host.ca";
$mailsubj = "Form submission";
$mailhead = "From: Smartmouth";
reset ($HTTP_POST_VARS);
$mailbody = "Values submitted from web site form:\n";
while (list ($key, $val) = each ($HTTP_POST_VARS)) {
//if(!eregi($key,"submit");
$mailbody .= "$key : $val\n\n"; }
if (!eregi("\n",$HTTP_POST_VARS[email])) { mail($mailto, $mailsubj, $mailbody, $mailhead); }feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]