parse multi-select input field
Posted: Mon Sep 22, 2008 2:41 pm
Hey all,
So, I have found how to echo the results of an input of a multi-select input field... but I cant seem to get it to go to the db...
here is all my code:
HTML Page (form)
thanks all,
Wes
So, I have found how to echo the results of an input of a multi-select input field... but I cant seem to get it to go to the db...
here is all my code:
HTML Page (form)
PHP page:<label>Subcategory:</label>
<?php
$result_category = @mysql_query("select id_lookup_category_, parent, category from wfbiblio.lookup_category where parent = 0");
print "<select multiple=\"true\" name=\"subcategory[]\" size=\"6\">\n";
while ($row = mysql_fetch_assoc($result_category)){
$id_lookup_category_ = $row['id_lookup_category_'];
$category = $row['category'];
print "<option value=$id_lookup_category_>$category\n";
}
print "</select>\n";
print "</p>\n";
?>
$id_lookup_subcategory=$_POST['subcategory'];
can anyone see what is wrong with this code?foreach ($id_lookup_subcategory_ as $subcategory){
$sql = "insert into wfbiblio.category_link (id_category_link_parent_, id_citation_, id_lookup_category_)
values ('$last_citation_id', '$last_id', '$subcategory')"; echo $sql;
$result = mysql_query($sql) or die (mysql_error()); }
thanks all,
Wes