multiple selection
Posted: Sat Feb 11, 2006 7:36 pm
Hi,
I have problem when I want to keep the selected items still selected after posting the page in $_POST[PHP_SELF] form.
It is easy to do it in other form fields but not the multiple selection field. I tried to do it in many ways but it won't work.
after I connect to DB and select the DB, here is the way I tired to do it:
I have problem when I want to keep the selected items still selected after posting the page in $_POST[PHP_SELF] form.
It is easy to do it in other form fields but not the multiple selection field. I tried to do it in many ways but it won't work.
after I connect to DB and select the DB, here is the way I tired to do it:
Code: Select all
<select multiple name="addtool_nmae">
<?php
while($row = mysql_fetch_array($query)){
$row = $row['addtool_name'];
if ($row = $_POST['addtool_name']) {
$selected = " selected";
}
print "<option value=\"$row\"$selected>$row</option>";
} // while
?>
</select>