I Thought it would be both logical and nifty to generate a drop-down menu that displays available materials and other not-so random elements for a catalog admin app I'm programming for a client.
No problem with the query and getting it to spit out a menu, but...
when you select an item and submit, it hangs.
Not realising that the $var is set (ie: URL="page.php?var=$var") though, it says it's loaded in the URL, the code wont react.
And in some spots, I've noticed it come up empty in the URL altogether, and that's for the one that was written w/o an SQL_query population (in HTML)!
This only happens on forms with the d-down menus...
Seems PHP doesn't like D-down menus.
Or, I'm doin something wrong (being the believer that I am in the godliness of PHP I prefer to think it's me)
I find, that if I build in code to make an exception for an empty variable, I can resubmit and have it go through.
That is a VERY sloppy fix, and a pain in the *ss to deal with on the user interface end.
Anyone have a clue to what could be causing this?
Here's the code to generate a D-down menu and text boxes:
if (mysql_field_name($fields, $i) == "mat") {
mysql_select_db("d_base");
$mat_type = mysql_query("SELECT mat_type FROM mat");
$row_array = mysql_fetch_row($mat_type);
echo ("<td><font face=\"verdana, arial, helvetica, sans-serif\" size=1><b>" . mysql_field_name($fields, $i) . "</b></font><br>");
For ($j = 0; $j < mysql_num_rows($mat_type); $j++) {
echo ("<OPTION value=\"" . $row_array[$j] . "\">" . $row_array[$j] . "</OPTION></td>");
}
} else {
echo ("<td><font face=\"verdana, arial, helvetica, sans-serif\" size=1><b>" . mysql_field_name($fields, $i) . "</b></font><br>
<input type=\"TEXT\" name=\"" . mysql_field_name($fields, $i) . "$v" . "\" size=\"" . mysql_field_len($fields, $i) . "\" maxlength=\"" . mysql_field_len($fields, $i) . "\"></td>");
}