select box not repeating
Posted: Thu Apr 01, 2010 3:44 am
Hello I am able to populate a select box with items form a mysql table no problem. But what I am creating is a form that repeats the fields depending on the users selection on the previous page. This works no problem, except for the select box. It fails to show all the results. It only displays the second result I have tried many combinations of nested loops but with no joy. In stead of posting all the code I will post the code which generates the select box. Ideas are welcome.
Code: Select all
echo "<fieldset>\n";
echo "<legend>\n";
echo "Products required for property\n";
echo "</legend>\n";
//echo $productItemLoop;
$ProductIDArray = "ProductID$propNumber";
$ProductIDArrayBrackets = "[]";
while($nt1=mysql_fetch_array($result)){
$product_options_open = "<option value=\"$nt1[ProductID]\">";
$row_productType = $nt1['ProductType'];
$product_options_close = "</option>\n";
}
echo "<p>\n";
echo "Hold 'Ctrl' to select more than one product\n";
echo "<br />\n";
echo "<select multiple";
echo " ";
echo "name=";
echo "\"$ProductIDArray$ProductIDArrayBrackets\"";
echo " ";
echo "id=\"$ProductIDArray\" size=\"5\">\n";
echo "$product_options_open\n";
echo "$row_productType\n";
echo "$product_options_close\n";
echo "</select>\n";
echo "</p>\n";
echo "</fieldset>\n";