Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7081307
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:54:14+00:00 2026-05-28T06:54:14+00:00

I’ve a simple Inset List (jQuery Mobile) of several items with a Flip switch,

  • 0

I’ve a simple Inset List (jQuery Mobile) of several items with a Flip switch, Drop down, check box and Slider elements.

I have wrapped this Inset List inside a HTML Form.

<div data-role="fieldcontain">
      <ul data-role="listview" data-inset="true">
        <li data-role="list-divider"> Inhouse capabilities </li>
        <li> <label for="flip-b">Project Manager</label>
            <select name="slider" id="flip-b" data-role="slider">
                <option value="no">No</option>
                <option value="yes">Yes</option>
            </select>
         </li>   
        <li> <label for="flip-b">Site Supervisor</label>
            <select name="slider" id="flip-b" data-role="slider">
                <option value="no">No</option>
                <option value="yes">Yes</option>
            </select>
        </li>
         <li><label for="flip-b">Architect</label>
            <select name="slider" id="flip-b" data-role="slider">
                <option value="no">No</option>
                <option value="yes">Yes</option>
            </select>
          </li>
        <li><label for="flip-b">Builderworks</label>
            <select name="slider" id="flip-b" data-role="slider">
                <option value="no">No</option>
                <option value="yes">Yes</option>
            </select>
          </li>
          <li><label for="flip-b">Electrical</label>
            <select name="slider" id="flip-b" data-role="slider">
                <option value="no">No</option>
                <option value="yes">Yes</option>
            </select>
          </li>
          <li><label for="flip-b">Mechanical</label>
            <select name="slider" id="flip-b" data-role="slider">
                <option value="no">No</option>
                <option value="yes">Yes</option>
            </select>
          </li>
          <li><label for="flip-b">Hydraulics</label>
            <select name="slider" id="flip-b" data-role="slider">
                <option value="no">No</option>
                <option value="yes">Yes</option>
            </select>
          </li>
          <li><label for="flip-b">Joinery</label>
            <select name="slider" id="flip-b" data-role="slider">
                <option value="no">No</option>
                <option value="yes">Yes</option>
            </select>
          </li>
          <li> 
                <label for="select-choice-1" class="select">Main Location:</label>
                   <select name="select-choice-1" id="select-choice-1">
                      <option value="NSW">NSW</option>
                      <option value="ACT">ACT</option>
                      <option value="VIC">VIC</option>
                      <option value="SA">SA</option>
                      <option value="QLD">QLD</option>
                      <option value="NT">NT</option>
                      <option value="WA">WA</option>
                      <option value="TAS">TAS</option>
                    </select>                     
          </li> <!-- Select Menus: Main Location-->

            <li>     
                <div  data-role="fieldcontain">
                <fieldset data-role="controlgroup">
                    <legend>CBA Reference</legend>
                    <input type="checkbox" name="checkbox-1a" id="checkbox-1a" class="custom" />
                    <label for="checkbox-1a">Commercial</label>
                    <input type="checkbox" name="checkbox-2a" id="checkbox-2a" class="custom" />
                    <label for="checkbox-2a">Retail</label>
                </fieldset>
                </div>
            </li>                          
 </ul>             
    </div> <!-- End of Field Contain div tag -->   
 <a href="#additionalinfo" data-role="button" data-inline="true" data-iconpos="left" data-theme="b">Additional Info</a>
<a href="./search2.html" rel="external" data-ajax="false" data-role="button" data-inline="true" data-icon="search" data-iconpos="left" data-theme="e">Search</a>

`

I want to know, how I can include only the elements the user selected in my SQL query.

Lets say, User wants to find the Electrical workers in QLD, then he will select Yes for Electrical and QLD as Main Location and the other items he would not touch.

Now, how can I include only those two values in the select clause.

Say, Select Electrical, Main Location from table where Main location=’QLD’.

I used POST method to gather users input. I use PHP, MySQL for this project.

Any ideas on how to achieve this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T06:54:14+00:00Added an answer on May 28, 2026 at 6:54 am

    I didn’t read the fields so you’ll have to adapt but it’s more of a php question than a mysql question. You’d have to build a list of criterias and then implode them together.

    $criterias = array();
    
    if(isset($_POST['option1']) && $_POST['option1'] == 'yes'){
        $criterias[] = '(mytable.myfield1 = 1)';
    }
    
    if(isset($_POST['option2']) && $_POST['option2'] == 'yes'){
        $criterias[] = '(mytable.myfield2 = 1)';
    }
    
    $sql = 'SELECT * FROM mytable'.(count($criterias) > 0 ? ' WHERE '.implode(' OR ', $criterias) : '').' ORDER BY mytable.sortkey';
    

    This will help you build any kind of criteria list that you want. Note that i used OR in the implode because these criterias seem to be inclusive, so you show workers based on their type based on the user’s choice. But i aint sure exactly if thats what you wanted.

    Note also that you can setup your criterias to be much more complex and combine two information together such as:

    if(isset($_POST['option2']) && $_POST['option2'] == 'yes'){
        $criterias[] = '(mytable.myfield2 = 1 AND mytable.location = "'.$_POST['location'].'")
    }
    

    That way, you could have many types that pertain to a specific location or even to different locations at once if you want.

    Good luck

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I am doing a simple coin flipping experiment for class that involves flipping a
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
Seemingly simple, but I cannot find anything relevant on the web. What is the
I'm making a simple page using Google Maps API 3. My first. One marker
I used javascript for loading a picture on my website depending on which small

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.