multiple selection
Posted: Fri Mar 24, 2006 6:55 pm
Hi,
I have problem when I try to keep the selected items still selected after posting the page.
I've found a thread in which this is subject is solved but the solution provided won't work for me.
The code is:
And the error is:
Is there any mistake?
Thanks in advance !!
I have problem when I try to keep the selected items still selected after posting the page.
I've found a thread in which this is subject is solved but the solution provided won't work for me.
The code is:
Code: Select all
<select name="provdist[]" class="form-select-mult" id="provdist" size="4" multiple >
<?php
$provincias = mssql_query('select * from md_provincias', $db->dblink);
while ( $row = mssql_fetch_row($provincias) ){
if ( array_search($row[0], $_POST['provdist'] ) ) {
echo('<option value=' . '\'' . $row[0] . '\'' . ' selected >' . $row[1] . '</option>');
continue;
}
echo('<option value=' . '\'' . $row[0] . '\'' . '>' . $row[1] . '</option>');
}
?>
</select>Code: Select all
<b>Warning</b>: array_search() [<a href='function.array-search'>function.array-search</a>]: Wrong datatype for second argument in <b>I:\WebServer\DOCEK\suplementos.php</b> on line <b>239</b><br />Thanks in advance !!