Code: Select all
--previous code--
$db = mysql_select_db($database,$connection)
or die ("Couldn't select database");
if ($industry=="-Any Dicipline-" && $city !="-Any City-"){
$query = "SELECT * FROM Proffesional_list WHERE city='$city'";
}
else if ($city=="-Any City-" && $industry!="-Any Dicipline-"){
$query = "SELECT * FROM Proffesional_list WHERE industry='$industry'";
}
else if ($city=="-Any City-" && $industry=="-Any Dicipline-"){
$query = "SELECT * FROM Proffesional_list";
}
else if ($city!="-Any City-" && $industry!="-Any Dicipline-"){
$query = "SELECT * FROM Proffesional_list WHERE industry='$industry' AND city='$city'";
}
$result= mysql_query($query)
or DIE("unable to retrieve database info");
rest of the code and echo statements...
only when i choose an actual item and location - the list is displayed - but when i choose one or the other or none at all - i get a blank listing.
The page with the dropdown menu precedes the page with the above code...
The dropdown menu in question is coded in php like so:
Code: Select all
$query2 = "SELECT DISTINCT city FROM Proffesional_list ORDER BY city";
$result2 = mysql_query($query2)
or die ("Couldn't execute query.");
/* create form containing selection list */
echo "<form action='code/memberdisplaylist.php' name='list1_form'>
<select name='industry'>\n";
echo "<option value='$industry'>-Any Dicipline-\n";//<--this should be the default value
while ($row = mysql_fetch_array($result))
{
extract($row);
echo "<option value='$industry'>$industry\n";
}
echo "</select>\n";
?>The items in the industry dropdown are pulled dynamically from the database - except for the default value.
Please help! Thanks in advance!