Help with Search Script

Hi, 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:

[code]


Search for


Zip



[/code]

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]<?php
require_once(‘scripts/_config.php’);
if(isset($_GET[‘Field’])){
$searchQ1=mysql_query(“SELECT First_Name,Last_Name,Nanny,Homecare_Provider,Childcare_Center,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;”);
}
?>[/php]

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.

Ignore that part in the php where homecare and childcare doesnt match from one query to the next. thats just a typo here. Its correct on my actual page. thanks

got it worked out

Sponsor our Newsletter | Privacy Policy | Terms of Service