jlam1021 Posted December 7, 2014 Share Posted December 7, 2014 So I have an existing picklist that i am trying to tweak - I am making it into a multiselect and trying to return multiple values I have been able to accomplish the first part by adding select 'multiple' but when i submit it only returns results for the last value selected. Here is the code for the form (Left out the picklists that do not need to be multiple select) <td align="center" valign="top"><? // base64_encode(base64_encode( 'test1'))?><br /><br /><form id='report_form' action="driverreport_sd.php" method="post" name="report_form"><!--<div class="criteria_div">--><table align="center" class="table_border" cellpadding="5" cellspacing="0" width="80%"><tr><td align="right" class="first_td">Status:</td><td align="left"><select multiple name='Status' id='Status'><? $statuslist=$ObjReport->ObjStatus->get_Status_List(); while($status=mysql_fetch_object($statuslist)) { if($status->Status=="Please Select") { ?><option value="<?=$status->Status?>" <?=($status->Status==$_REQUEST['Status']?"selected=selected":"")?>><?=$status->Status?></option><? } else { ?><option value="<?=$status->Status?>" <?=($status->Status==$_REQUEST['Status']?"selected=selected":"")?>><?=$status->Status?></option><? } } ?></select></td></tr><td align="center" colspan="2"><input type="hidden" id='sort_by' name='sort_by' value="<?=$_REQUEST['sort_by']?>" /><input type="hidden" name='search_val' id='search_val' value="<?=$_REQUEST['search_val']?>" /><input type="hidden" name='search_by' id='search_by' value="<?=$_REQUEST['search_by']?>" /><input type="hidden" name="report_submited" value='report_submited' /><button type="submit" id="report_submited" name="" value='submit'>Submit</button></td> and here is the return request <? if($_REQUEST['report_submited']) { $ReportData=$ObjReport->generate_report($_REQUEST['Status'],$_REQUEST['School'],$_REQUEST['Campaign'],$_REQUEST['State'],$_REQUEST['Stdtype'],$_REQUEST['Primbad'],$_REQUEST['Rep'],$_REQUEST['From_Date'],$_REQUEST['To_Date'],$_REQUEST['sort_by'],$_REQUEST['search_by'],$_REQUEST['search_val']); $currentTotalRow=mysql_num_rows($ReportData); if($currentTotalRow>0) { ?> Any suggestions would be appreciated Thanks! Quote Link to comment Share on other sites More sharing options...
Barand Posted December 7, 2014 Share Posted December 7, 2014 You need to append [] to the select name so the choices are posted as an array <select multiple name='Status[]' id='Status'> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.