First see my code.
<select multiple name='assign_to[]'>
<?
$result_10 = mysql_query("select * from login_users") or die(mysql_error());
while($row_10 = mysql_fetch_object($result_10))
{
echo "<option value=".$row_10->user_id.">".$row_10->username."</option>";
}
?>
</select>
I am able to get value when page is submitted no issue with this but my problem is :
When page is submitted I am redirecting to the same page then I want that options which are selected before submitting the form will seen selected after page is submitted.
What PHP code is to written there. What I did for single selected drop down as :
<?
while($row_10 = mysql_fetch_object($result_10))
{
?>
<option <?=$row_10->user_id==$_POST['assign_to']?'selected':''?> value="<?=$row_10->user_id?>"><?=$row_10->username?></option>
<?
}
?>
Hope you are getting my question ?
Thanks!!!
As your $_POST[‘assign_to’] is an array i guess this will work.
OR you can use conditional operators :