Forum Moderators: coopster

Message Too Old, No Replies

Drop Down Menu Help

         

bodycount

8:55 am on Nov 17, 2005 (gmt 0)

10+ Year Member



I am trying to do a search using a pull down menu which gets all it's option's from the YOB field in my database, Which it does, but when you select any date it always comes back with the last entrie in the the drop down menu and not the date selected. What have I dont wronge?.

_____________________________________________________

Drop down menu code.
_____________________________________________________

$query5 = "SELECT DISTINCT YOB FROM ADDRESSES ORDER BY YOB DESC";
$result5 = mysql_query($query5);
$num_rows=mysql_num_rows($result5);
echo "<select name=\"YOB\">";

//$result5 = mysql_query($query5);
//echo "<OPTION SELECT>$YOB";

while ($row=mysql_fetch_array($result5))

{
$YOB = $row["YOB"];
echo "<option>$YOB";
}
echo "</select>";

_____________________________________________________

Display records code.
_____________________________________________________

// YOB search start

if ($YOB!="" )

{

$query3 = "SELECT * FROM ADDRESSES WHERE YOB LIKE \"%$YOB%\" LIMIT 200";

$result3 = mysql_query($query3);

if($num=mysql_numrows($result3))

{
echo "<p>";
echo "<table align=\"center\" border=\"8\">";
echo "<tr><th colspan=5><b><center><font size=-1>Birth Year</th></tr>";
echo "<tr><th><font size=-1>ID</th><th><font size=-1>Birth Name</th><th><font size=-1>Married Name</th><th><font size=-1>Year Of Birth</th><th><font size=-1><font size=-1>Place of Brith</th></tr>";

while ($record = mysql_fetch_array($result3))
{

$ID = $record["ID"];
$FULLNAME = $record["FULLNAME"];
$MARRIED_NAME = $record["MARRIED_NAME"];
$YOB = $record["YOB"];
$PLACEBIRTH3 = $record["PLACEBIRTH"];

echo "<tr><td><a href=\"pre_change.php?row_ID=$ID\"><font size=-1>$ID</a></td><td><font size=-1>$FULLNAME</td><td><font size=-1>$MARRIED_NAME</td><td><font size=-1>$YOB</TD><TD><font size=-1>$PLACEBIRTH3</TD></TR>";

}
}
}
// YOB search END

jackvull

12:08 pm on Nov 17, 2005 (gmt 0)

10+ Year Member



I think the HTML format should be
<select>
<option value="">
<option etc.
</select>

Could you post some of the HTML that results from your PHP script?

bodycount

2:07 pm on Nov 17, 2005 (gmt 0)

10+ Year Member



Yeh it works

Thanks for your reply, That was one of my problems with it.

So thanks again.