Jump to content

query and display items from multiple dropdown menu on new page


kristy7

Recommended Posts

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
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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