Jump to content

[SOLVED] help w/ multiple select form vars


skycruiser

Recommended Posts

OK I'm trying to submit multiple POST vars from one page to the next from a select form.  I looked at the manual on this and still don't understand.  Here's the code as it is now.  I've tried all sorts of variations on this (putting [] behind var names, putting indexes all kinds of stuff) and I couldn't get it to work. 

 

echo "<form action=\"ConfigReport.php\" method=\"post\">\r\n";

// Start Table
echo "<table border=\"0\" cellpadding=\"5\" width=400>\r\n";
echo "<tr><td>\r\n";

echo "<select name=\"unit_display\" SIZE=4 MULTIPLE>\r\n";
for ($i=0; $i<$number2; $i++) {
$sn_name = mysql_result($result2,$i,"sn_name");
echo  "<option value=\"$sn_name\">$sn_name</option>\r\n";    
}
echo "</select></td></tr>\r\n";
echo "<tr><td><p><input type=\"submit\" name=\"submit\" value=\"Submit\"></p>\r\n";
echo "</form>\r\n";

 

And how to I address these passed vars on the next page?  I tried:

$units[] = $_POST['unit_display'];

 

And many variations on that theme but I couldn't get it to receive all values, just the last value.

Link to comment
https://forums.phpfreaks.com/topic/43078-solved-help-w-multiple-select-form-vars/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.