Jump to content

Problem with search form and results page


chuck1971

Recommended Posts

I have a drop down search form that I am populating with information from my database, and when I try to use it to search, I am returned with my page, but with no results.  What am I doing wrong here?  Thanks in advance for all te help!Here is the drop down code and the results page: 

 

<td>

<select name="county" class="form" id="county" style="width: 165px">

<option value="">Any</option>

<?

include("includes/connect.php");

$county = mysql_query("SELECT * FROM locations ORDER BY county ASC");

while($result_county = mysql_fetch_array($county)) { ?>

<option value="<? echo $result_county['county']; ?>" ><? echo $result_county['county']; ?></option>

<? } ?>

</select></td>

<td align="right"><input name="Submit" type="submit" class="form" value="Submit" />

 

 

 

 

And here is the code for the results page: 

 

 

 

 

<?

include("includes/connect.php");

$id = $_GET['id'];

$query = mysql_query("SELECT * FROM locations WHERE id = $id");

$result = mysql_fetch_array($query);

$numrows=@mysql_num_rows($query);

if($numrows != 0) {

while ($result = mysql_fetch_array($query)) {

?>

<tr>

<td><table width="100%" border="0" cellspacing="0" cellpadding="0">

<tr>

<td><div align="justify" style="padding-top:1ex; padding-right:1.5ex; padding-bottom:1ex; padding-left:1.5ex"><strong><? echo $title; ?></strong><br /><? echo $address; ?><br /><? echo $city; ?>, <? echo $state; ?>  <? echo $zipcode; ?><br />Phone:  <? echo $phone; ?><br /><a href="location_details.php?id=<? echo id; ?>">Click Here for more information</a></div></td>

</tr>

</table></td>

</tr>

<? } } ?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.