Page 1 of 1
Radio button
Posted: Sun Oct 05, 2008 2:02 pm
by raygo22
Hello. I am a newbie in the php world! but this is what I want to accomplish:
Two radio buttons, male and female. If male is pressed some input fields will appear concerning men, and if female is pressed then the input fields that will appear are related to women. Can somebody help me?! thanks!
Re: Radio button
Posted: Sun Oct 05, 2008 2:22 pm
by phppucci
if 'some fields' should appear/disappear according to radio button selection without page refreshing, the only way is using javascript or javascript framework, say jquery.com or similar.
Re: Radio button
Posted: Sun Oct 05, 2008 3:16 pm
by raygo22
Thanks for your quick response. How about with page refreshing. How can i do it? Thanks
Re: Radio button
Posted: Sun Oct 05, 2008 3:27 pm
by phppucci
Raygo, do it using javascript, read a bit about jquery at jquery.com, it is perfect tool for manipulating html page elements.
Re: Radio button
Posted: Sun Oct 05, 2008 8:44 pm
by raygo22
Hello. I was reading and couldnt find something useful. I dont know if it is that i am too new!! can you please help me with this code? thanks
Re: Radio button
Posted: Mon Oct 13, 2008 9:17 pm
by efortis
If you don't want to learn js just do 2 different pages, and then use links pointing to each one.
but try learning some: google for onClick event
Re: Radio button
Posted: Mon Oct 13, 2008 10:21 pm
by omniuni
If you want, you can either go with a page refresh (a href="?gender=male") or if you object to a refresh, create an iFrame which you can target with the links and load the questions to be answered into the iFrame.
Otherwise, some simple Javascript.... innerHTML.replace or something..... I don't do much javascript.
Good Luck,
OmniUni