Jump to content


Photo

query and display items from multiple dropdown menu on new page


  • Please log in to reply
No replies to this topic

#1 kristy7

kristy7
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 26 April 2006 - 12:25 AM

Hi All,

I am pretty much a newbie when it comes to php and mysql. I am having trouble doing a job for work where I have multiple drop down boxes attached to a mysql database, each linked to a separate table. I want to select an option from each dropdown and generate a query which will search another table that all the dropdown tables are linked to and give me the data selected and print to a new page.

I have the dropdowns working I am just not sure how to do the query to incorporate the user selected options and print it to a new page, any help would be much appreciated, this is the gist of what I have so far....

// set up form for selecting required soil type
print "<form>";
print "<center>";
print "<table height=20 cellSpacing='0' cellPadding='5' border='2' width='30%' bgColor='#DFF7FF' >";
print "<tr>";
print " <td width='30%'> <font face='Arial' size='2'>Pool Type:</font></td>";
print " <td width='*'>";
print " <select NAME='soil Type' ID='soilType' onChange='displayProcedure(this.form)'> '\n";
print " <option value='nil'> Choose a soil Type .... \n";

// connect and execute query

$query = "SELECT soilType FROM soilType ORDER BY soilType ";
$resulta = mysql_query($query, $dbcnx) or die ("Database query error: " . mysql_error());
while ( $a_row = mysql_fetch_object($resulta) )
{
print "<option value='$a_row->soilType'> $a_row->soilType \n";
};
print "</select>";
print "</tr>";
print "</table>";
print "</form>";


this gives me my dropdown selection of soil type, I also have location and area, this info is linked to tblgrower which is the table I want to query. please help I have been fiddling with this for ages and can not get it, especially sending the result to a new page





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users