Page 1 of 1

Possible to use PHP for form select OnChange event?

Posted: Thu May 24, 2007 2:22 pm
by tech_kitten
I'm a PHP n00b and need to know if it's possible to use PHP to show/hide form elements based on a previous <select> element's OnChange event..........I've tried a couple of things that haven't worked.....

I have been told to avoid using javascript if at all possible because of the fact that some users will either have javascript turned off in their browsers or blocked at the firewall level - but I need to find a way for some form fields to remain hidden unless other form fields have been selected or checked.......

If it's possible to do this with PHP then I don't mind spending the time to learn how to do it, but if it's not possible and I simply must use javascript, then I won't waste the next few days of my time trying to figure it out in PHP.

Thanks for any advice and all advice offered.......

Posted: Thu May 24, 2007 2:33 pm
by feyd
Showing and hiding elements without page refresh is the domain of Javascript.

Posted: Thu May 24, 2007 2:41 pm
by tech_kitten
Thank you - I had a feeling it couldn't be done without using javascript, just don't have enough experience yet myself to be 100% certain........I appreciate the response!

Posted: Thu May 24, 2007 3:47 pm
by s.dot
What you do is make all the forms visible, and then use javascript to hide the ones that you need until they need shown. This way, users with javascript disabled will still have all the forms available, and users with javascript enabled will get the effect you're looking for.

Posted: Thu May 24, 2007 10:29 pm
by lanasa