RE: Dynamic pull down menus with PHP/Mysql

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> -----Original Message-----
> This may be a more javascript related topic, but it's also php/mysql.
> Apologies in advance if this is too far off topic.
> 
> I'm trying to pull data from MySQL using PHP to sort the results into a
> form with a pull down menu. That works fine; I can do that.
> 
> But I have a second pull down menu whose items need to display based on
> the item chosen from the first pull down menu.
> 
> I can do two lists seperately, but I need the second pull down menu to be
> a result of the first, and I can't figure a way to do it in PHP without
> reloading the page, which I don't really want to do.
> 
> Is this a javascript-dependent function, in that a js will have to make
> the call to the database via some sort of scripted php/mysql request? I
> really like to avoid javascript if possible, but I'm unsure there's an
> alternative.

You're describing what I think is called "Dynamic Options".  Doing a Google
for "javascript dynamic option" or "javascript dynamic select" will pull-up
a few examples.

Most of these solutions will expect you to load all data into javascript
arrays.  In other words, you don't have to reload the page, because all of
the data is already present.

This approach doesn't work well when dealing with large amounts of data.  If
you're running into this, use javascript's window.opener feature.  It allows
you to spawn a second window that retrieves data and sends it to the first
window.

-Ed



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux