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

  • SEARCH
  • Home
  • 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 8157201
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T17:12:06+00:00 2026-06-06T17:12:06+00:00

I’d like to get some help with my search script. A little about the

  • 0

I’d like to get some help with my search script. A little about the site: I have registered users and when they register they select their user type (ie Nanny, Homecare, Daycare). Right now I have a search bar and visitors can input their zip code and the results page shows everything in the database with that zip code.
Current form:

<form id="form1" name="form1" method="get" action="results.php">
    <p>
      <label>Search for<input type="text" name="Search" id="Search"  /></label>
      <label>
        <select name="Field" id="Field">
          <option value="Zip">Zip</option>   
        </select>
      </label>
      <input type="submit" name="button" id="button" value="Search" />
   </p>

What I would like to do is to have it where users enter their zip code and select Nanny, Homecare, or Daycare from a drop down and the results shows only that type in the search results instead on everything within that zip.

How I want the form to look:

<form id="form1" name="form1" method="get" action="results.php">
    <p>
      <label>Search for<input type="text" name="Search" id="Search"  value="Zip" /></label>
      <label>
        <select name="Field" id="Field">
          <option value="Nanny">Nanny</option>
          <option value="Homecare">Homecare</option>
          <option value="Childcare">Childcare</option>   
        </select>
      </label>
      <input type="submit" name="button" id="button" value="Search" />
    </p>
</form>

The php:

<?php
require_once('scripts/_config.php');
if(isset($_GET['Field'])){
$searchQ1=mysql_query("SELECT `First_Name`,`Last_Name`,`Nanny`,`Homecare`,`Childcare`,`City`,`State`,`Zip`,`userID` FROM `sys_profile` WHERE `".$_GET['Field']."` LIKE '".$_GET['Search']."';");
}else{
$searchQ1=mysql_query("SELECT `First_Name`,`Last_Name`,`Nanny`,`Homecare`,`Childcare`,`City`,`State`,`Zip`,`userID` FROM `sys_profile` WHERE `userID`!=0;");
}
?>

How do I change the php so that the search results displays only nannies within the entered zip, or childcare in the entered zip, etc? Right now the php shows everything in that zip and when I change the form to the second example it still doesn’t work because I’m not sure how to adjust the search query.

  • 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-06-06T17:12:08+00:00Added an answer on June 6, 2026 at 5:12 pm

    You have to include the second constraint with an AND inside the query. Compare the Zip, that is contained in the $_GET['Search'] with the Zip file in the DB, and the selected value form the dropdown with the user type in the db.

    How does your DB look like? Especially, how is the user type information saved? Guessing from your posted query, these are boolean values (Nanny, Homecare, Childcare)?

    EDIT: When Nanny, Homecare and Childcare are boolean values, a possible query would be:

    $sql = "SELECT First_Name,Last_Name, City, State, userID FROM sys_profile WHERE Zip = " . $_GET['Search'] . " AND $_GET['Field'] = true";
    

    So you check if the Zip matches the search string, AND if the selected drop down item has the value true.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have some data like this: 1 2 3 4 5 9 2 6
For some reason, after submitting a string like this Jack’s Spindle from a text
I have just tried to save a simple *.rtf file with some websites and
I have a French site that I want to parse, but am running into
I have two tables with like below codes: Table: Accounts id | username |
I don't have much knowledge about the IPv6 protocol, so sorry if the question
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I would like to count the length of a string with PHP. The string
link Im having trouble converting the html entites into html characters, (&# 8217;) i

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.