I need help passing multiple values from a list box to my processing page. I am not using a database since it is a short-term web page and it would take me longer to set one up with all the red tape I have to go through. I have also been searching to try to figure this out.
I have three list boxes that allow people to choose multiple times for a user to pick. When I click, submit it only pick-ups the last one that was clicked on.
Here is my code for my form:
<?php
if (!$HTTP_COOKIE_VARS[‘orgchaos’]){
?>
<html>
<head>
<title>Organized Chaos Volunteer Forum</title>
</head>
<body>
<form method=”post” action=”processchaos.php”>
<table border=0 width=”791″>
<tr>
<td colspan=”2″ align=”center”> <img src=”
</td>
</tr>
<tr >
<td colspan=”2″ align=”center” style=”font-size:24px;”><strong>Organized Chaos Volunteer Registration Form</strong></td>
</tr>
<tr>
<td width=”333″ >Full name:</td>
<td width=”448″ ><input type=”textarea” name=”Fname” width=”250″></td>
</tr>
<tr>
<td>Primary Email:</td>
<td ><input type=”textarea” name=”peremail” width=”250″ ></td>
</tr>
<tr>
<td>Class Year:</td>
<td><select name=”classof” id=”classof”>
<option value=”96″ selected=”true”>1996</option>
<option value=”97″>1997</option>
<option value=”98″>1998</option>
<option value=”99″>1999</option>
<option value=”00″>2000</option>
<option value=”01″>2001</option>
<option value=”02″>2002</option>
<option value=”03″>2003</option>
<option value=”04″>2004</option>
<option value=”05″>2005</option>
<option value=”06″>2006</option>
</select>
</td>
</tr>
<td>T-shirt size:</td>
<td><select name=”Tshirt” id=”Tshirt”>
<option value=”s” selected=”true”>Small</option>
<option value=”m”>Medium</option>
<option value=”l”>Large</option>
<option value=”xl”>X-Large</option>
</select>
</td>
</tr>
<tr><td colspan=”2″>Please Check the dates you would like to help</td></tr>
<tr>
<td>Friday, August 18 at the Rivers & Kelly House</td>
<td><select name=”Tfri” id=”Tfri” size=”2″ multiple>
<option value=”f12to2″ selected=”true”>12to2 pm</option>
<option value=”f2to4″>2-4 pm</option>
<option value=”f4to6″>4-6pm</option>
<option value=”f6to9″>6-9 pm</option>
</select></td>
</tr>
<tr>
<td>Saturday, August 19 at Berry, College Lodge, McConnell, </td>
<td><select name=”Tsat” id=”Tsat” size=”2″ multiple>
<option value=”sa9to11″ selected=”true”>9-11 am</option>
<option value=”sa11to1″>11am-1 pm</option>
<option value=”sa1to3″>1-3pm</option>
<option value=”sa3to5″>3-5pm</option>
</option>
</select></td>
</tr>
<tr>
<td>Sunday, August 20 at McAlister
Warren Place, Craig, Historic Houses</td>
<td><select name=”tsun” size=”2″ multiple id=”tsun”>
<option value=”su9to11″ selected=”true”>9-11 am</option>
<option value=”su11to1″>11am-1 pm</option>
<option value=”su1to3″>1-3pm</option>
<option value=”su3to5″>3-5pm</option>
</option>
</select></td></td>
</tr>
<tr>
<td colspan=”2″><p><font color=”#FF0000″><em>Please check the area you would like to help with:</em></font></p></td>
</tr>
<tr>
<td>Moving-In Students Belongings</td>
<td align=”center”><input type=”checkbox” value=”Movein”>
</tr>
<tr>
<td>Greeting Students and Parents</td>
<td align=”center”><input type=”checkbox” value=”Greeting”>
</tr>
<tr>
<td>Pedestrian Traffic Control</td>
<td align=”center”><input type=”checkbox” value=”Traffic”>
</tr>
<tr>
<tr>
<td>Comments:</td>
<td ><textarea name=”Comments” width=”350″ ></textarea></td>
</tr>
<tr>
<tr>
<td colspan=2 align=center><input type=submit value=”Submit Survey”></td>
</tr>
</table>
</form>
</body>
</html>”
<?php
end;}
else
{
?>
<html><body><p align=”center”>
<img src=”
<?php
end;}
?>
Here is my process web page:
<?PHP
setcookie (“orgchaos”, “Ture”, time() +7776000, “/”, “.cofc.edu”);
?>
<html>
<head>
</head>
<body>
<p align=”center”><img src=”
<?PHP
$Fname = $HTTP_POST_VARS[“Fname”];
$peremail = $HTTP_POST_VARS[“peremail”];
$classof = $HTTP_POST_VARS[“classof”];
$Tshirt = $HTTP_POST_VARS[“Tshirt”];
$Tfri = $HTTP_POST_VARS[“Tfri”];
$Tsat = $HTTP_POST_VARS[“Tsat”];
$tsun = $HTTP_POST_VARS[“tsun”];
$Comments = $HTTP_POST_VARS[“Comments”];
$Movein = $HTTP_POST_VARS[“Movein”];
$Greeting = $HTTP_POST_VARS[“Greeting”];
$Traffic = $HTTP_POST_VARS[“Traffic”];
$outputstring = $Fname.”,”.$peremail.”,”.$classof.”,”.$Tshirt.”,”.$Tfri.”,”.$Tsat.”,”.$tsun.”,”.Movein.”,”.Greeting.”,”.Traffic.”,”.$Comments.”n”;
// open file for appending
@ $fp = fopen(“orgchaos.txt”, “a”);
flock($fp, 2);
if (!$fp)
{
echo “<p align=”center”><strong> Your Survey could not be submitted at this time please try again later.”
.”</p></body></html>”;
exit;
}
fwrite($fp, $outputstring);
flock($fp, 3);
fclose($fp);
$names=explode(” “,$Fname);
echo $names[0].” thank you for your time in taking the the survey.”;
?>
</p>
</body>
</html>