Hello PHPB,
I have a form that populates a table, and creates a select only if the value of that cell equals none. The options of the select are populated dynamically as well. There are over 100 options.
My trouble is when I go to submit the form, I'm unable to distinguish between the selects for the update. It only sees the last select in the post which makes sense because all of the selects share the same name.
I guess I'm missing another evaluation of some sort...
How can I modify my code to also generate a dynamic input select name for that particular select?
What should the update script look like to catch the select $_POSTs?
This example shows two items in the lower table, they are both categorized as NONE. Thus you will see two different select boxes.
This example though, shows five.
The full source code is here, and yes I'm a newbie so my code will probably make you die a little inside. Apologies
The php snippet that does the select generation looks like this currently...
else {
echo '<td>';
echo '<select style="width:300px" name="category" id="category">';
echo '<option selected="true" value="0">SELECT A CATEGORY</option>';
//Otherwise get the list of options for a select
$db = mysql_connect("$dbHost", "$dbUser", "$dbPass") or die ("Error connecting to database.");
mysql_select_db("$dbDatabase", $db) or die ("Couldn't select the database.");
$result = mysql_query("SELECT * from cat_wff");
$numResults = mysql_numrows($result);
for($i=0;$i<$numResults;$i++) {
echo '<option value="'.mysql_result($result,$i,"CAT_WFF").'">';
echo mysql_result($result,$i,"Category").'</option>'."\n";
}
echo '</select></td>';
Thank you in advance if you are able to help me understand.
Respectfully,
Aaron