Eiolon Posted June 6, 2007 Share Posted June 6, 2007 Hi all. I am wanting to disable a check box when another one is checked. Here is a screenshot of what I am trying to do. Basically, if the registration fee box is checked I want the online registration box to be disabled (because participants can't pay online from the website). Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/54438-disable-a-checkbox-when-another-one-is-checked/ Share on other sites More sharing options...
trq Posted June 6, 2007 Share Posted June 6, 2007 Either use a radion button, or post your question in the Javcascript forum. Quote Link to comment https://forums.phpfreaks.com/topic/54438-disable-a-checkbox-when-another-one-is-checked/#findComment-269232 Share on other sites More sharing options...
Eiolon Posted June 6, 2007 Author Share Posted June 6, 2007 So I take it this cannot be done with PHP? I was reading on a solution using Javascript but it appears it only works in IE. Quote Link to comment https://forums.phpfreaks.com/topic/54438-disable-a-checkbox-when-another-one-is-checked/#findComment-269236 Share on other sites More sharing options...
danmon Posted June 6, 2007 Share Posted June 6, 2007 the check boxes have to have the same name, in that case when you select one the other one becomes unselected Quote Link to comment https://forums.phpfreaks.com/topic/54438-disable-a-checkbox-when-another-one-is-checked/#findComment-269238 Share on other sites More sharing options...
per1os Posted June 6, 2007 Share Posted June 6, 2007 So I take it this cannot be done with PHP? I was reading on a solution using Javascript but it appears it only works in IE. PHP is server-side. Meaning it does not know anything that goes on after the data is displayed without a POST BACK to PHP. Javascript and html is Client-side, which means that they can interpret stuff when a user clicks on something without a POST BACK. Quote Link to comment https://forums.phpfreaks.com/topic/54438-disable-a-checkbox-when-another-one-is-checked/#findComment-269241 Share on other sites More sharing options...
dbillings Posted June 6, 2007 Share Posted June 6, 2007 This is not PHP but, <form> <input type="radio" name="option" value="0"> A registration fee is required for this program. <br /> <input type="radio" name="option" value="1"> Ask for participants age when registering for this program. <br /> <input type="submit" name="submit" value="Submit"> </form> Then you just add the additional options to the form as needed. Quote Link to comment https://forums.phpfreaks.com/topic/54438-disable-a-checkbox-when-another-one-is-checked/#findComment-269591 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.