473,387 Members | 1,791 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Drop Down Menu

keyvanrahmadi
Hello every one,

I have just recently started learning Mysql/PHP and i am trying to design a page with drop down menus which will allow the user to select what they want to see and submit the query. So far this is how far i have gone, which i am sure is not far.

[PHP]<?PHP

// Connecting to the database server
$link = mysql_connect("connection", "user", "pass");
// Selecting database
mysql_select_db("db");

// Performing MYSQL query
$result = mysql_query('SELECT name FROM location_o2')
or die('Query failed: ' . mysql_error());


// Printing results in HTML
echo "<form action='#'>\r\n<select name=location>\r\n";
while ($line = mysql_fetch_array($result, MYSQL_NUM)) {
$house = $line[0];
echo " <option value=$house>$house\r\n";
}
echo "</select>\r\n <input type=submit value=SELECT>\r\n</form>\r\n";

?>[/PHP]

The above will create a drop down menu with 2 entry (London, Liverpool). The concept is that the user selects a city and by submiting their choice they can in this case see all the available cars in that city.

any ideas and suggections will be greatly appriciated.

keyvan
Feb 4 '07 #1
12 1593
Motoma
3,237 Expert 2GB
Welcome to The Scripts, keyvanrahmadi.

What type of suggestions are you looking for?
Feb 4 '07 #2
Welcome to The Scripts, keyvanrahmadi.

What type of suggestions are you looking for?
I am sorry i should have been more clear, whats confusing me is how i can use the user's choice from menu and out put the result on the same page.

http://ati.amd.com/support/driver.html

Above link will show you what i have in mind, a bit ambitious for starter like me but hey i like jumping in the deep end and try to figure it out.

keyvan
Feb 4 '07 #3
cassbiz
202 100+
When I went over to amd's site, are you referring to the drop down menu in regards to selecting your location.

This is handled via Javascript.

Or are you referring to a different part of the page?
Feb 4 '07 #4
Motoma
3,237 Expert 2GB
I have moved this thread to the Javascript forum. The folks there should be much more helpful.
Feb 4 '07 #5
r035198x
13,262 8TB
Hello every one,



I have just recently started learning Mysql/PHP and i am trying to design a page with drop down menus which will allow the user to select what they want to see and submit the query. So far this is how far i have gone, which i am sure is not far.



<?PHP



// Connecting to the database server

$link = mysql_connect(\"connection\", \"user\", \"pass\");

// Selecting database

mysql_select_db(\"db\");



// Performing MYSQL query

$result = mysql_query(\'SELECT name FROM location_o2\')

or die(\'Query failed: \' . mysql_error());





// Printing results in HTML

echo \"<form action=\'#\'>\\r\\n<select name=location>\\r\\n\";

while ($line = mysql_fetch_array($result, MYSQL_NUM)) {

$house = $line[0];

echo \" <option value=$house>$house\\r\\n\";

}

echo \"</select>\\r\\n <input type=submit value=SELECT>\\r\\n</form>\\r\\n\";



?>



The above will create a drop down menu with 2 entry (London, Liverpool). The concept is that the user selects a city and by submiting their choice they can in this case see all the available cars in that city.



any ideas and suggections will be greatly appriciated.



keyvan


Have a read at this thread.
Feb 5 '07 #6
r035198x
13,262 8TB
Have a read at this thread.


Or maybe this one.
Feb 5 '07 #7
acoder
16,027 Expert Mod 8TB
r0, those links point to http://this/ (!!)
Feb 5 '07 #8
r035198x
13,262 8TB
r0, those links point to http://this/ (!!)


Something went wrong with my links there. Try



http://www.thescripts.com/forum/thread583887.html



Feb 5 '07 #9
I would like to thank every one for thier input and various hints and links the provided.. it has helped greatly.

keyvan
Feb 7 '07 #10
acoder
16,027 Expert Mod 8TB
No problem, you're welcome. If you have any more problems, feel free to post again.
Feb 7 '07 #11
r035198x
13,262 8TB
I would like to thank every one for thier input and various hints and links the provided.. it has helped greatly.



keyvan


I am not sure if all the links posted helped you.
Feb 7 '07 #12
acoder
16,027 Expert Mod 8TB
I am not sure if all the links posted helped you.
Well, at least the last one did.
Feb 7 '07 #13

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: KK | last post by:
Drop-down menus are the hottest thing since Wonder Bread but . . . 1. Alot of people put them in the they-look-nice-but-you-cant-code-them-right-so-they-always-look-messed-up category (a la...
10
by: Haines Brown | last post by:
I've implemented the horizontal drop down menu discussed recently in this newsgroup, and it works nicely under Galeon and Mozilla, but not IE 5.0. Here are the problems: Under IE 5.0, the...
0
by: vikram.cvk | last post by:
Hello Experts, Im trying to design a CSS vertical drop down menu which should have the following functionality. Home About Us | -->Overview
2
by: hemanth.singamsetty | last post by:
Hello there, I've a drop down menu (created using CSS & Javascript -- see code below). My problem is, whenever I click a link on the menu the new page replaces the current page (and the menu...
4
by: simon.cigoj | last post by:
I have an javascript made menu and some forms with the dropdown element. When the menu opens and scrolls down the drop down is displeyed over the menu and obscures the menu choices. I have this...
1
by: phpnewb | last post by:
Hi, I know i'm doing it wrong, but I'm using a while loop right now to create several instances of a drop down menu. It gives me undesirable results. Can you tell me the right way to do it. Below are...
3
by: rsteph | last post by:
I have a javascript drop down menu that I borrowed from a website. It utilizes a little .css to help with formatting. The menu works great, and on all 3 of the browsers I'm concerned about; but I am...
4
by: TycoonUK | last post by:
Hi, As I do not have IE7 on my computer, I was wondering if there is a fault in my CSS Menu when using IE7. Please can someone look at my site - http://www.worldofmonopoly.co.uk and tell me...
1
by: Kaland | last post by:
Do the search engines follow links that are within forms (like the drop-down menu) so that those pages are indexed? Here is the code for a sample drop-down menu that I created. <form><select...
22
by: Archanak | last post by:
Hi, I am using 2-level CSS Drop Down Menu in my perl/CGI program. here is the code. #!c:/perl/bin/perl.exe use CGI qw(:standard);
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.