View Full Version : Email HTML Form Data with PHP

03-22-2010, 01:49 AM
Hello, I am trying to have my contactus.html file form go to my php page and send an email to me everything is working the areas that require more than one selection. I need help.

Here is the one line of HTML code for the form:

<select name="opSystem[]" size="9" multiple="yes" id="opSystem">

so then the form data is linked to my php file and this is what I have for this section of the php file

$body = "We have received the following information:\n\n";
$opSystem[] = $row['opSystem'];
foreach($opSystem as $o) {
$body .= 'Operating System(s): $o\n';
} //This one does not work
foreach($fields as $a => $b){ $body .= sprintf("%20s: %s\n",$b,$_REQUEST[$a]); } //This one works

where the second foreach statement sends the rest of the form data. That part works. What I want it to say is:

We have received the following information:

Operating System(s): **List My Form Selection Data Here**

What am I doing wrong?? I have been working all day on it. Please Help Thanks

03-22-2010, 03:37 AM
So I figured it out and fixed it myself here it is for those who looked and could not help.

$opSystem = array();
$opSystem = $_REQUEST['opSystem'];

$body = "We have received the following information:\n\n";
foreach($fields as $a => $b){ $body .= sprintf("%20s: %s\n",$b,$_REQUEST[$a]); }
$body .= "Operating System(s): ";
foreach($opSystem as $o) {
$body .= "$o, ";