close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 or 2018 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

"All" option for a drop down - how?

Thread began 3/25/2016 3:56 am by Nathon Jones Web Design | Last modified 3/25/2016 1:42 pm by Ray Borduin | 98 views | 1 replies |

Nathon Jones Web Design

"All" option for a drop down - how?

This is my form...

<form class="form-horizontal" name="searcheventsFORM" id="searcheventsFORM" method="post" action="traditional-music-events-search.php">
<label for="searchTYPE" class="col-sm-4 control-label">Type of Event:</label>
<select id="searchTYPE" name="searchTYPE" class="form-control" tabindex="1">
<option value="2">Classes/Workshops</option>
<option value="6">Concert / Gig</option>
<option value="4">Festival</option>
<option value="5">Folk Club</option>
</select>

<label for="searchKEYWORD" class="col-sm-4 control-label">Search:</label>
<input type="text" class="form-control" id="searchKEYWORD" name="searchKEYWORD" placeholder="Keyword/s, town/city, region..." maxlength="100" tabindex="2">

<button type="submit" class="btn btn-default" name="searcheventsBTN" tabindex="3"><span class="glyphicon glyphicon-search"></span> Search</button>
</form>



This is my search results page Query Builder code...

<?php
$rsEVENTS = new WA_MySQLi_RS("rsEVENTS",$csdbmysqli,0);

$rsEVENTS->setQuery("SELECT TMSAevent.tmsaeventID, TMSAevent.tmsaeventtypeID, TMSAevent.tmsaevent, TMSAevent.tmsastartdate, TMSAevent.tmsaenddate, TMSAevent.tmsavenueID, TMSAevent.tmsaeventsummary, TMSAevent.tmsaeventdesc, TMSAevent.tmsaeventDELETE, TMSAevent.tmsaeventPHONE, TMSAevent.tmsaeventEMAIL, TMSAevent.tmsaeventWEB, TMSAvenues.tmsavenuename, TMSAvenues.tmsaorgname, TMSAvenues.tmsavenuecontactname, TMSAvenues.tmsavenueaddress, TMSAvenues.tmsavenuetown, TMSAvenues.tmsavenuepostcode, TMSAcountry.tmsacountry, TMSAregions.tmsaregion FROM TMSAevent INNER JOIN TMSAvenues ON TMSAevent.tmsavenueID = TMSAvenues.tmsavenueID INNER JOIN TMSAcountry ON TMSAvenues.tmsacountryID = TMSAcountry.tmsacountryID INNER JOIN TMSAregions ON TMSAvenues.tmsaregionID = TMSAregions.tmsaregionID WHERE TMSAevent.tmsaeventtypeID = ? AND TMSAevent.tmsastartdate >= ? AND TMSAevent.tmsaeventDELETE = 2 AND (TMSAevent.tmsaevent LIKE ? OR TMSAevent.tmsaeventsummary LIKE ? OR TMSAevent.tmsaeventdesc LIKE ? OR TMSAvenues.tmsavenuename LIKE ? OR TMSAvenues.tmsaorgname LIKE ? OR TMSAvenues.tmsavenuecontactname LIKE ? OR TMSAvenues.tmsavenueaddress LIKE ? OR TMSAvenues.tmsavenuetown LIKE ? OR TMSAcountry.tmsacountry LIKE ? OR TMSAregions.tmsaregion LIKE ?) ORDER BY TMSAevent.tmsastartdate ASC");

$rsEVENTS->bindParam("i", "".(isset($_POST['searchTYPE'])?$_POST['searchTYPE']:"") ."", ""); //WAQB_Param1
$rsEVENTS->bindParam("t", "".(isset($_SESSION['todaySESH'])?$_SESSION['todaySESH']:"") ."", "-1"); //WAQB_Param2
$rsEVENTS->bindParam("c", "".(isset($_POST['searchKEYWORD'])?$_POST['searchKEYWORD']:"") ."", ""); //WAQB_Param3
$rsEVENTS->bindParam("c", "".(isset($_POST['searchKEYWORD'])?$_POST['searchKEYWORD']:"") ."", ""); //WAQB_Param4
$rsEVENTS->bindParam("c", "".(isset($_POST['searchKEYWORD'])?$_POST['searchKEYWORD']:"") ."", ""); //WAQB_Param5
$rsEVENTS->bindParam("c", "".(isset($_POST['searchKEYWORD'])?$_POST['searchKEYWORD']:"") ."", ""); //WAQB_Param6
$rsEVENTS->bindParam("c", "".(isset($_POST['searchKEYWORD'])?$_POST['searchKEYWORD']:"") ."", ""); //WAQB_Param7
$rsEVENTS->bindParam("c", "".(isset($_POST['searchKEYWORD'])?$_POST['searchKEYWORD']:"") ."", ""); //WAQB_Param8
$rsEVENTS->bindParam("c", "".(isset($_POST['searchKEYWORD'])?$_POST['searchKEYWORD']:"") ."", ""); //WAQB_Param9
$rsEVENTS->bindParam("c", "".(isset($_POST['searchKEYWORD'])?$_POST['searchKEYWORD']:"") ."", ""); //WAQB_Param10
$rsEVENTS->bindParam("c", "".(isset($_POST['searchKEYWORD'])?$_POST['searchKEYWORD']:"") ."", ""); //WAQB_Param11
$rsEVENTS->bindParam("c", "".(isset($_POST['searchKEYWORD'])?$_POST['searchKEYWORD']:"") ."", ""); //WAQB_Param12
$rsEVENTS->execute();
?>



How do I add an "All" option for the Type drop down menu so that when the users searches they're shown all types of event?

Thank you.
NJ

Sign in to reply to this post

Ray BorduinWebAssist

Add the "All" option to the list:

<option value="">All</option>

Then update the query:
$rsEVENTS->setQuery("SELECT TMSAevent.tmsaeventID, TMSAevent.tmsaeventtypeID, TMSAevent.tmsaevent, TMSAevent.tmsastartdate, TMSAevent.tmsaenddate, TMSAevent.tmsavenueID, TMSAevent.tmsaeventsummary, TMSAevent.tmsaeventdesc, TMSAevent.tmsaeventDELETE, TMSAevent.tmsaeventPHONE, TMSAevent.tmsaeventEMAIL, TMSAevent.tmsaeventWEB, TMSAvenues.tmsavenuename, TMSAvenues.tmsaorgname, TMSAvenues.tmsavenuecontactname, TMSAvenues.tmsavenueaddress, TMSAvenues.tmsavenuetown, TMSAvenues.tmsavenuepostcode, TMSAcountry.tmsacountry, TMSAregions.tmsaregion FROM TMSAevent INNER JOIN TMSAvenues ON TMSAevent.tmsavenueID = TMSAvenues.tmsavenueID INNER JOIN TMSAcountry ON TMSAvenues.tmsacountryID = TMSAcountry.tmsacountryID INNER JOIN TMSAregions ON TMSAvenues.tmsaregionID = TMSAregions.tmsaregionID WHERE TMSAevent.tmsaeventtypeID = ? AND TMSAevent.tmsastartdate >= ? AND TMSAevent.tmsaeventDELETE = 2 AND ((TMSAevent.tmsaevent LIKE ? OR TMSAevent.tmsaeventsummary LIKE ? OR TMSAevent.tmsaeventdesc LIKE ? OR TMSAvenues.tmsavenuename LIKE ? OR TMSAvenues.tmsaorgname LIKE ? OR TMSAvenues.tmsavenuecontactname LIKE ? OR TMSAvenues.tmsavenueaddress LIKE ? OR TMSAvenues.tmsavenuetown LIKE ? OR TMSAcountry.tmsacountry LIKE ? OR TMSAregions.tmsaregion LIKE ?) OR ? = '') ORDER BY TMSAevent.tmsastartdate ASC");

And add the parameter one last time to the end of the parameter list:

$rsEVENTS->bindParam("c", "".(isset($_POST['searchKEYWORD'])?$_POST['searchKEYWORD']:"") ."", ""); //WAQB_Param13

Sign in to reply to this post

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...