How to display html form selects (via checkbox) in email?

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I have a simple form to collect user selections in html form.  I am

pretty new to can I send the user's checkbox selects to me

in an email...I am struggling with buiding an array to send this info

mail() function.  Any help appreciated... Thanks very much!




<b>Please select the information you'd like to



<form method="post"


<input type="checkbox" name="foo[]"

value="Auto">Auto Insurance

<input type="checkbox" name="foo[]"

value="Life">Life Insurance

<input type="checkbox" name="foo[]"

value="Home">Home Insurance


<input type="submit" value="Submit">

<input type="reset" value="Clear">



echo "You have chosen to receive information on: \n\n";

// check to be sure at least one option was selected<br>

$foo = $_POST['foo'];

if (count($foo) > 0) {

// loop through the array

for ($i=0;$i<count($foo);$i++) {

// do something - this can be a SQL query, echoing data to the

browser, or whatever

echo "<li>$foo[$i]\n";

} // end "for" loop

} // endif

echo "<br>";

echo "insurance products.\n";


 :lol: -php- web design

Re: How to display html form selects (via checkbox) in email?

I'm not completely sure what you're wanting here.

To use your foo[] array,

if(isset($_POST['foo'])) {
  if (count($foo) > 0) {
  //database i/o, mail(), etc.

Site Timeline