I have a number of form pages with about 25 fields each. I am wanting to email the data collected in these forms and have been trying to accomplish this by looping through the form posted variables so that I don't have to manually grab each field for each form. Everything in the script works except the loop. I am fairly new to PHP and any help would be greatly appreciated.
Here is my code:
<?
$to = "jhandy@test.com";
$subject = "New Form Submission";
$from = "webmaster@test.com";
$message = "A new form has been submitted from the website:\n\n";
do {
$message .= key($_Request) . ": " . $_Request[key($_Request)] . "\n";
} while(next($_Request));
mail($to, $subject, $message, "FROM: $from"
;
?>
Thanks!
Here is my code:
<?
$to = "jhandy@test.com";
$subject = "New Form Submission";
$from = "webmaster@test.com";
$message = "A new form has been submitted from the website:\n\n";
do {
$message .= key($_Request) . ": " . $_Request[key($_Request)] . "\n";
} while(next($_Request));
mail($to, $subject, $message, "FROM: $from"

?>
Thanks!