fgonzales Posted May 2, 2008 Share Posted May 2, 2008 I am wanting to do a query that does two things one it searches a directory with a form that searches keywords and city, state and also searches a sepereate database for some extended data, using keyword and city, state. I want to do this using a form to submit just the keyword to the main directory and both keyword and city, state to search the extended data. The way the form is set up I would have to first strip out the city, state and pass it to some hidden field and search just keyword in the main directoy, then put the keyword and city, state into another set of hidden fields to do the search of the extended data. Here is a link to my working example http://kentucky.mylocallookup.com/listing/ if you just search for the keyword atv you get three listings and no courtesy listings for atv. Now if you do a search for atv with the city richmond, ky you get just that one listing in richmond but not the other tow listings and you get 2 courtesy listings. I want to be able to just submit the keyword to the main directory so it returns the three listings, then passes the keyword and the city, state to extended search to bring back the courtesy listings as well. here is my form code that i trying to do this with <script Language = JavaScript> function justcity() { fname = document.form1.searchs.value SplitName = fname.split(", ") first = SplitName[0] statt = SplitName[1] document.form1.city.value = first document.form1.state.value = statt } </script> <form id="form1" name="form1" method="get" action="/listing/results.php"> <p class="standardTitle">lookup <span>Business</span></p> <dl class="simpleSearch"> <dt class="label">Keyword:</dt> <input name="page" type="hidden" id="page" value="search" /> <dd><input name="keyword" type="text" class="searchtext" id="keyword" value="<?=$keyword;?>"/></dd> <dt class="label">City, State or Zip Code:</dt> <dd><input name="searchs" type="text" class="searchtext2" id="searchs" value="<?=$searchs;?>" onChange="justcity()" /></dd> <input type='hidden' name='city' id='city' value='<?=$city;?>'> <input type='hidden' name='states' id='states' value='<?=$state;?>'> <?php if(isset($_REQUEST['act'])) { $cities = $_REQUEST['city']; $sqlresult = mysql_query("SELECT * FROM Location_Region WHERE name = '$cities'"); while($row = mysql_fetch_array($sqlresult)) { $citid = $row['id']; } echo "<input type='hidden' name='region_id' id='region_id' value='" . $citid . "' />"; } ?> <dd> <ul class="standardButton"> <li><input name="act" type="submit" class="searchbutton" id="button" value="search" /> </li> <li class="buttonSpace"> </li> <li><a href="javascript:void(0);" onClick="searchReset();">Clear</a></li> </ul> </dd> </dl> </form> I hope there is someone with more knowledge than me that can help me out. thank you in advanced Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.