Dear All,
In my work I have to select multiple items from a list box which contains values from database. In the next page I have to show all the selected values and unselected values in the list box when user submits the selected values. The problem I am facing is: I am able to display all the selected values but I am unable to display unselected values. Hence I request you please find a solution for me and solve this problem.
I am putting my code that I used to get values and display them in the next page.
1) display.php
<?
<!....Normal db arguments and other items.....>
echo"<TR>";
echo"<TD vAlign=\"top\" align=\"left\" width=\"283\" height=\"14\" colspan=\"2\">";
echo"<SELECT size=\"4\" multiple name=\"paperchoices[]\">";
$qryarlist = "select article_id,article_name from nuke_user_articles";
$arlistname=$dbconn->Execute($qryarlist);
while(list($atid,$aname) = $arlistname->fields)
{
//print "\t<option>";
//print "$aname\n";
echo "<option value=$atid>$aname\n";
//echo "<option value=$aname>$aname\n";
$arlistname->MoveNext();
}
echo"</SELECT></TD></TR>";
echo"<TR>";
echo"<TD vAlign=\"top\" align=\"left\" width=\"283\" height=\"14\" colspan=\"2\">";
echo"<input type=\"submit\" value=\"Submit\" name=\"buttonSubmit\"><input type=\"reset\" value=\"Reset\" name=\"buttonReset\"></TD></TR>";
?>
2) confirm.php
<?
<!....Normal db arguments and other items.....>
if(count($paperchoices)!=null)
{
echo"<TR>";
echo"<TD vAlign=\"top\" align=\"left\" width=\"283\" height=\"14\" colspan=\"2\">
<font class=\"pn-normal\"><B><br>
Send me article(s): <br></font></B>";
echo"<SELECT size=\"4\" multiple name=\"paperchoices[]\">";
foreach($paperchoices as $value)
{
$qryselect="select article_id,article_name] from nuke_user_articles where article_id]=$value";
$arlistnames = $dbconn->Execute($qryselect);
list($atid,$aname) = $arlistnames->fields;
echo "<option selected value=$atid>$aname\n";
}
echo"</SELECT></TD></TR>";
}
<!... other items...>
?>
regards,
Indrajit.