| | |
Double Dropdown Submit ,PHP ,MYSQL
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Oct 2006
Posts: 4
Reputation:
Solved Threads: 0
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:
=======
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:

=======
php Syntax (Toggle Plain Text)
<form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post" > <table width="450" border="0" cellspacing="0" cellpadding="0"> <tr> <td><b>Wind:</b></td> <td><select name="wind"> <option>--Please Select--</option> <option>S</option> <option>SW</option> <option>N</option> <option>NW</option> <option>E</option> </select></td> </tr> <tr> <td><b>Region:</b></td> <td><select name="region"> <option>--Please Select--</option> <option>West</option> <option>Easte</option> <option>South</option> <option>North</option> </select></td> </tr> <tr> <td> </td> <td><label> <input type="submit" name="Submit" value="Submit"> </label></td> </tr> </table> </form> ------------------------------------------------------------------------- //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 ------------------------------------------------------------------------- <?php include("functions.php"); Connect(); if($REQUEST_METHOD=="POST") { } 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>"; if(!isset($row[$i])){ echo "Null"; }else { echo $row[$i]; } echo "</td>\n"; } echo "</tr>\n"; } echo "</table>"; ?>
Last edited by cscgal; Oct 25th, 2006 at 2:07 pm.
•
•
Join Date: Jul 2004
Posts: 494
Reputation:
Solved Threads: 21
You're connecting to the server presumably in functions.php? How's that working?
www.uncreativelabs.net
Old computers are getting to be a lost art. Here at Uncreative Labs, we still enjoy using the old computers. Sometimes we want to see how far a particular system can go, other times we use a stock system to remind ourselves of what we once had.
Old computers are getting to be a lost art. Here at Uncreative Labs, we still enjoy using the old computers. Sometimes we want to see how far a particular system can go, other times we use a stock system to remind ourselves of what we once had.
Hi artiry,
Its pretty hard to figure out whats happening from just the code you provided. Maybe functions.php should be posted also.
Its pretty hard to figure out whats happening from just the code you provided. Maybe functions.php should be posted also.
www.fijiwebdesign.com - web design and development and fun
Cpanel Email - Let users Register email accounts on your website upon registration
Ajax Chat - Fully browser based chat!
Cpanel Email - Let users Register email accounts on your website upon registration
Ajax Chat - Fully browser based chat!
•
•
Join Date: Oct 2006
Posts: 4
Reputation:
Solved Threads: 0
Hi
Here is a link where you can see what i wanna do, like click on a wind and region, then all the correct info displays.
function.php just connects to database for now.
http://firecracker.co.za/surf/surf_test.php
Thanks
Here is a link where you can see what i wanna do, like click on a wind and region, then all the correct info displays.
function.php just connects to database for now.
http://firecracker.co.za/surf/surf_test.php
Thanks
You'll need to post the code where you put together the mysql query. At the moment all that can be seen is $query.
www.fijiwebdesign.com - web design and development and fun
Cpanel Email - Let users Register email accounts on your website upon registration
Ajax Chat - Fully browser based chat!
Cpanel Email - Let users Register email accounts on your website upon registration
Ajax Chat - Fully browser based chat!
![]() |
Similar Threads
Other Threads in the PHP Forum
- Previous Thread: price comparison- need tips
- Next Thread: display results of search from drop down menu
Views: 4688 | Replies: 6
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access address ajax apache api array autoincrement beginner binary broken cakephp checkbox class cms code cron curl database date dehasher directory display download dynamic echo email error file files folder form forms function functions google href htaccess html image include insert integration ip java javascript joomla jquery limit link login loop mail menu method methods mlm mod_rewrite multiple mysql oop parse paypal pdf php problem query radio random recursion regex remote script search select server sessions sms soap source space speed sql structure support! syntax system table tutorial update updates upload url validation validator variable video web xml youtube






