Re: Dynamic value lookups
| From: | ROBERT MCPEAK | Date: | Mon, 02 Jun 2003 20:06:27 +0000 |
| Subject: | Re: Dynamic value lookups | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-149838@lists.php.net to get a copy of this message | ||
I agree that you will probably have to build all possible select value arrays on pageload if you
want the select list to switch without a page reload. PHP is parsed by the webserver and then sent
to the page. Javascript is parsed by the browser. You can use PHP to "dynamically"
generate Javascript, which can be pretty cool.
A great example of what you're trying to do can be seen on many car dealership websites, where
you first select a car "make" and then all possible models for that make appear with a
page refresh in the "model" select list. Snoop around for that javascript source and
you'll be on your way.
I agree with prior respondant that this is a PHP list, so that's it about JS from me. Just
know that you can do anything with PHP as long as you can get a page load in there to parse the
script. Keep in mind ways you can use PHP to build JS on the fly at on pageload.
Good luck!
>>> Vijay Avarachen <stalione@avarachen.net> 06/02/03 03:44PM >>>
Ok I am attempting to do something very simple and I know it can be
done, but I have been told otherwise. I have two select menu's,
Products and Components. There is a one to many relationship between
them (one product can have many components). I just want it so that
when the user selects an entry in Products, Components get dynamically
loaded (I know I gotta do somethign with onchange="" but not sure what).
Value of Products and Components are being pulled form a database.
Someone told me the only way to do this is to load all the values of
components into an array and pass it around. Thats just dont' sound
right to me.
I was thinking perhaps I can just do somthing like
onchange="PHP_SELF?product=<value>". No I know thats not the syntax but
you get the idea =)
Any help would be appreciated. Please keep in mind i have very very
little knowledge of javascript.
Sincerely,
Vijay Avarachen
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php