Possible to use PHP for form select OnChange event?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
tech_kitten
Forum Newbie
Posts: 2
Joined: Thu May 24, 2007 1:35 pm

Possible to use PHP for form select OnChange event?

Post 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.......
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Showing and hiding elements without page refresh is the domain of Javascript.
tech_kitten
Forum Newbie
Posts: 2
Joined: Thu May 24, 2007 1:35 pm

Post 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!
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post 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.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
lanasa
Forum Newbie
Posts: 14
Joined: Mon Mar 26, 2007 7:49 am
Location: Buffalo, NY

Post by lanasa »

Post Reply