skycruiser Posted March 17, 2007 Share Posted March 17, 2007 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 More sharing options...
cshireman Posted March 17, 2007 Share Posted March 17, 2007 Try this: chage echo "<select name=\"unit_display\" SIZE=4 MULTIPLE>\r\n"; to echo "<select name=\"unit_display[]\" SIZE=4 MULTIPLE>\r\n"; and in your form handler use this: $units = $_POST['unit_display']; Link to comment https://forums.phpfreaks.com/topic/43078-solved-help-w-multiple-select-form-vars/#findComment-209262 Share on other sites More sharing options...
skycruiser Posted March 17, 2007 Author Share Posted March 17, 2007 Thanks. I would SWEAR I tried that already and it didn't work but it does now! Link to comment https://forums.phpfreaks.com/topic/43078-solved-help-w-multiple-select-form-vars/#findComment-209266 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.