Hi to all :cheesy:

The Problem::-|
I was wondering if someone could perhaps help me with a problem i have for a while now. I want to use two dropdowns and a submit button.
Sounds pretty easy, but when php and mysql comes in, then it gets a bit sticky.
Thanks in advance, if someone can/will help.
The Solution:;)
Dropdown 1:five Winds:(S,N,E,W,NW)
When the user clicks on the 1stdropdown and chooses a wind eg.S
Dropdown 2:four Regions:(EAST,WEST,NORTH,SOUTH)
When the user clicks on the 2nddropdown and chooses a region eg.West.
Then presses the submit button.
The Idae::eek:
Now what must happen is that all the info from the database that connect those to options clicked must display.
I just do not know how "connect" dropdowns with the database.

And then a table must display with a lot of Locations that falls within what the user choosed.
input:Eg. S, West, SUBMIT
output:Eg. Africa(text) - This place is nice(text) - picture(img)
input: Eg. N, South, SUBMIT
output:Eg. America- This place is nice - picure

Code Sofar::sad:

<form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post" >
<table width="450" border="0" cellspacing="0" cellpadding="0">
<td><select name="wind">
<option>--Please Select--</option>
<td><select name="region">
<option>--Please Select--</option>
<input type="submit" name="Submit" value="Submit">
//This is the code to display,connect to server, but this is not the way, it should work, it doesnt even connect with the dropdown
if (!isset($query) || empty($query)){
$query = "Select * from location "; 
$query= stripslashes($query); 
$result = mysql_query($query) or
die( mysql_error() ); 
$number_cols = mysql_num_fields($result);
echo "<b>Query: $query</b>";
echo "<table width=500 border = 4>\n";
echo "<tr align =center bgcolor=\"lightblue\">\n";
for ($i=0; $i<$number_cols; $i++)
echo "<th>" . mysql_field_name($result, $i). "</th>\n";
echo "</tr>\n";
while ($row = mysql_fetch_row($result)) { 
echo "<tr valign = top>\n";
for ($i=0; $i<$number_cols; $i++)
if($i % 2){
echo "<td bgcolor=lightgrey horizon>";
}else{echo "<td bgcolor=white>";}
//echo "<td>";
echo "Null";
echo $row[$i];
echo "</td>\n";
echo "</tr>\n";
echo "</table>"; 
11 Years
Discussion Span
Last Post by artiry


Yes i am connecting to the server in functions.php, its working fine, when i upload the files, and press submit the info displays immediate, regardless what i choose in the drop down, thats the problem im having.

Thanks for looking at it.


Hi artiry,
Its pretty hard to figure out whats happening from just the code you provided. Maybe functions.php should be posted also.



Thats problem i have, i want to select from the dropdown, then submit.

Then all will show from that selection, i do not know how to let the dropdown interact with the sql, once i can one then i can modify it to work with other options


This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.