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>

<? } } ?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.