Current location: Hot Scripts Forums » Programming Languages » PHP » mysql database & dropdown menu


mysql database & dropdown menu

Reply
  #1 (permalink)  
Old 03-16-04, 02:54 PM
lizzzz lizzzz is offline
New Member
 
Join Date: Mar 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
mysql database & dropdown menu

i need help with the following:
from my mysql database i have presented data (addresses) in a drop down menu. now i would like to start a further query by clicking on one of these addresses. the result should be represented in a new window.
with javascript functions i think that this would be solvable, but unfortunately i have few notion of javascript and am therefore helpless, how to approach the problem.
i am grateful for each assistance.

Last edited by lizzzz; 03-16-04 at 03:34 PM.
Reply With Quote
  #2 (permalink)  
Old 03-16-04, 11:04 PM
blaw's Avatar
blaw blaw is offline
Junior Code Guru
 
Join Date: Dec 2003
Location: Vancouver, BC, Canada
Posts: 550
Thanks: 0
Thanked 0 Times in 0 Posts
Hi there,

In your combobox, place an onChange event that would open up a new window. In the first parameter of open(), make sure to pass whatever has been selected (i.e. selectedIndex.value) via GET. For the destination file, receive the GET parameter and you can do whatever you want with it then.

Something like this, if you insist that you don't know much about JavaScript:

Code:
<select name="mySelect" onChange="javascript:window.open('my.php?addr=' + this[this.selectedIndex].value, '', 'location=1');">
	<option value="def">Choose One</option>
	<option value="foo">Option FOO</option>
	<option value="the">Option THE</option>
	<option value="bar">Option BAR</option>
</select>
The above pops up a new window (URL= my.php) with whatever has been selected (its value attribute: e.g. If Option BAR is selected, it will be "bar"). In my.php, you can get this value by referring to $_GET['addr'].

I set the location to be true to see if the parameter is really passed, but you can configure in a way you like. open() is one of the most used, if not the most abused, JavaScript functions and I am sure you can find plenty of info about it and I recommend that you learn.

Good luck.
__________________
Blavv =|
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP Form to update a MySQL database? Scoobler PHP 9 09-04-08 01:41 AM
PHP and MySQL ? rob2132 Hot Scripts Forum Questions, Suggestions and Feedback 4 08-29-08 02:22 AM
question about updating a page or database for an, php and mysql updating mikewooten PHP 1 02-12-04 12:11 AM
Importing to a mysql database via php gulfan PHP 1 01-23-04 04:44 PM
how to import a png file from mysql database. rani PHP 1 01-16-04 03:34 AM


All times are GMT -5. The time now is 10:19 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.