Page 1 of 1
Dropdown List populated based on the contents of another
Posted: Sun Jul 17, 2011 3:15 pm
by tinwakr
Hi Everyone,
Just a quick question regarding dropdown lists, is it possible, without the use of Javascript and just PHP, to have text fields/dropdown lists, etc. in a form, to be populated based on changing the value of another dropdown list and if so, would someone be kind enough to explain how or point me to information that would show me?
Thanks,
Chuck
Re: Dropdown List populated based on the contents of another
Posted: Sun Jul 17, 2011 3:54 pm
by McInfo
Yes, but the form would have to be submitted back to the server each time a selection is made.
Re: Dropdown List populated based on the contents of another
Posted: Sun Jul 17, 2011 8:29 pm
by tinwakr
Thanks for the quick reply McInfo,
Would you be able to point me to information such as code examples or a tutorial?
Thanks,
Chuck
Re: Dropdown List populated based on the contents of another
Posted: Sun Jul 17, 2011 11:37 pm
by McInfo
Basically, it involves using conditional statements to build the form based on what inputs have been received.
I don't know of any specific examples/tutorials, but I'm sure a search engine does.
Re: Dropdown List populated based on the contents of another
Posted: Mon Jul 18, 2011 2:45 am
by scular
I think its not easy to do this without javascript or ajax so dont waste your time its just a wastage of time
Re: Dropdown List populated based on the contents of another
Posted: Mon Jul 18, 2011 11:24 am
by McInfo
I don't think it's a waste of time to support users who disable JavaScript.
Re: Dropdown List populated based on the contents of another
Posted: Mon Jul 18, 2011 11:29 am
by angelicodin
I'm sure you could use some kind of dynamic xml with php to do some conditional changes with the onChange. ~shrugs~ personally I use java for these types of things but it would be interesting to find out how to get around using java. Like McInfo said, be good for people who don't use java on their browsers.
~following~
Re: Dropdown List populated based on the contents of another
Posted: Mon Jul 18, 2011 1:23 pm
by McInfo
angelicodin wrote:I use java for these types of things
You mean JavaScript? (JavaScript is not Java.)