don't know if this will help, but you could do something like this foreach ($hashes as $name => $variable) {
switch ($name) { case 'board': $nameText = "PCB Type"; break; case 'size': $nameText = "PCB Size"; break; case 'numb': $nameText = "Amount Required"; break; case 'days': $nameText = "Delivery Time"; break; } print "<TR><TD>$nameText: </TD><TD>\n<select name=\"$name\" onChange=\"this.form.submit();\">\n"; foreach ($variable as $key => $value) { if ($_SERVER['REQUEST_METHOD'] == 'POST') { if ($value == $_POST[$name]) { print "<option value=\"$_POST[$name]\">$key</option>\n"; } } } // end inner for each foreach ($variable as $key => $value) { if ($value != $_POST[$name]) { print "<option value=\"$value\">$key</option>\n"; } } // end inner for each print "</select>\n</TD></TR>\n"; } // end for each outer this uses these arrays: // size options hash $optionSize = array( '0.1 Squ.Dcm' => 0.1, '0.25 Squ.Dcm' => 0.25, '0.5 Squ.Dcm' => 0.5, '0.75 Squ.Dcm' => 0.75, '1 Squ.Dcm' => 1, '2 Squ.Dcm' => 2, '3 Squ.Dcm' => 3, '4 Squ.Dcm' => 4, '6 Squ.Dcm' => 6, '8 Squ.Dcm' => 8, '10 Squ.Dcm' => 10 ); // numb options hash $optionNumb = array( '1 circuit' => 1, '2 circuits' => 2, '3 circuits' => 3, '4 circuits' => 4, '5 circuits' => 5, '10 circuits' => 10, '20 circuits' => 20, '30 circuits' => 30, '40 circuits' => 40, '50 circuits' => 50 ); // days options hash $optionDays = array( '10 scheduled' => 10, '5 scheduled' => 6, '5 working days' => 5, '4 working days' => 4, '3 working days' => 3, '2 working days' => 2, ); // board options hash $optionBoard = array( '0.8 single' => 1, '0.8 double' => 2, '0.8 PTH' => 3, '1.6 single' => 4, '1.6 double' => 5, '1.6 PTH' => 6, '3.2 single' => 7, '3.2 double' => 8, '3.2 PTH' => 9, // '1.6 4-layer' => 10, // '1.6 6-layer' => 11, ); $optionDaysSmall = array('10 scheduled' => 10); // hashes hash $hashes = array( 'board' => $optionBoard, 'size' => $optionSize, 'numb' => $optionNumb, 'days' => $optionDays, ); but it shouldn't be to hard to dynamically make the arrays, hope this helps regards Mark Cubitt > -----Original Message----- > From: Edward Peloke [mailto:[EMAIL PROTECTED] > Sent: 24 February 2003 14:02 > To: [EMAIL PROTECTED] Php. Net > Subject: [PHP] dynamic list box > > > Hello, > > I have an sql statement that pulls data into a dynamic list box, > the problem > is, I have this list box twice on my form, since the query > returns a lot of > rows, I do not want to have the query executed twice but I > populate my list > box using the while loop so when it is time for the second list box, the > query is already at end of file. I tried to get my result then just copy > that to another array but that doesn't seem to work, any one have > any ideas? > > THanks, > Eddie > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > > ****************************************************************** > ************ > This email has been virus checked by the Eclipse Internet > MAILsafe service > ****************************************************************** > ************ > www: http://www.eclipse.net.uk/ email: > [EMAIL PROTECTED] > ****************************************************************** > ************ > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php