Storing Array of dropdown box into table
Posted: Tue Apr 12, 2005 3:55 pm
Hi
You guys helped me solve a problem before, and I was hoping that you might be able to help me with the following. I have an for loop that creates a list of drop down boxes and checkboxes.
The list is changeable hence why i had to do this.
How do I create the sql update (or insert) query that accepts these changed variable names.
Many thanks in advance.
Brendon
You guys helped me solve a problem before, and I was hoping that you might be able to help me with the following. I have an for loop that creates a list of drop down boxes and checkboxes.
The list is changeable hence why i had to do this.
Code: Select all
$linkID = mysql_connect("localhost", "root", "durban12");
mysql_select_db("talent", $linkID);
$resultID = mysql_query("SELECT fun_list_id, fun_list_name, fun_checkbox
FROM function_list where fun_list_active = '1'", $linkID);
$row = mysql_fetch_assoc($resultID);
print "<font face='Arial, Helvetica, sans-serif'> <table border=\"1\"><tr><th><font size='1' >Function ID</th>";
print "<th><font size='1'>Functional Experience</th>";
print "<th><font size='1'>Year Exp.</th>";
print "<th><font size='1'>Core</th></tr>";
for ($x = 0; $x <mysql_num_rows($resultID); $x++)
{
$row = mysql_fetch_assoc($resultID);
print "<tr>";
print "<td><font size='1'>" . $row[fun_list_id] ."</td>";
print "<td><font size='1'>" . $row[fun_list_name] ."</td>";
print "<td><font size='1'> <select name='select".$row[fun_list_id]."'>
<option value='0'>None</option>
<option value='1'><6 months</option>
<option value='2'>6-12 months</option>
<option value='3'>18 months</option>
<option value='4'>2-3 years</option>
<option value='5'>3-4 years</option>
<option value='6'>>5 years</option>
</select>";
print "<td> <input type='checkbox' name='checkbox".$row[fun_list_id]."'/></td>";
print "</tr>";
} //close for loop
print "</font></table>";
mysql_close($linkID);Many thanks in advance.
Brendon