close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Search with multiple select

Thread began 1/25/2017 4:11 am by georgina_barrett_187762 | Last modified 9/07/2017 8:39 am by georgina_barrett_187762 | 1852 views | 6 replies

georgina_barrett_187762

Search with multiple select

I have a form with 2 fields one of which is a multiple select:
<form id="form1" name="form1" method="get" action="wagesList.php"><table>
<tr>
<th>
Select Week:</th>
<td><select name="Week[]" multiple="multiple" id="Week">
<?php
while(!$week->atEnd()) { //dyn select
?>
<option value="<?php echo($week->getColumnVal("Week")); ?>"><?php echo($week->getColumnVal("Week")); ?></option>
<?php
$week->moveNext();
} //dyn select
$week->moveFirst();
?>
</select></td>
<td>&nbsp;</td>
</tr>
<tr>
<th>Travel Expert:</th>
<td><select name="expert" id="expert">
<?php
while(!$expert->atEnd()) { //dyn select
?>
<option value="<?php echo($expert->getColumnVal("TravelExpert")); ?>"><?php echo($expert->getColumnVal("TravelExpert")); ?></option>
<?php
$expert->moveNext();
} //dyn select
$expert->moveFirst();
?>
</select></td>
<td><input name="submit" type="submit" class="managerbutton" id="submit" value="Submit" /></td>
</tr>


</table>
</form>

I am trying to search the database for records that match (both fields are varchar). The expert column is optional, but the Week column has to have a value. This is my code:
<?php
$commission = new WA_MySQLi_RS("commission",$horizon_i,0);
$commission->setQuery("SELECT Commissions.*, Request.TravelExpert FROM Request JOIN Commissions ON Request.ID=Commissions.RequestID WHERE Request.TravelExpert LIKE ? AND Commissions.Week=?");
$commission->bindParam("c", "".$_GET['expert'] ."", "-1"); //colname
$commission->bindParam("s", "".$_GET['Week'] ."", "-1"); //colname1
$commission->execute();
?>
If there is one value submited for 'Week' it works but if multiple are it doesn't. How do I get it to search multiple values?

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...