[PHP] radio buttons checked or not
hi... i have this code: ?if($old['Type']==Annual){? input type=radio name=eventtype value=Annualchecked accesskey=yYes ?}else {? input type=radio name=eventtype value=OneTime checked accesskey=nNo?}? was just wondering if that was the right way to determine the state of a radio button...? if the value of $old['Type']=Annual then the yes button is checked...if not then the no button is checked instead... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] radio buttons checked or not
[snip] i have this code: ?if($old['Type']==Annual){? input type=radio name=eventtype value=Annualchecked accesskey=yYes ?}else {? input type=radio name=eventtype value=OneTime checked accesskey=nNo?}? was just wondering if that was the right way to determine the state of a radio button...? if the value of $old['Type']=Annual then the yes button is checked...if not then the no button is checked instead... [/snip] Check for the value assigned to each if(Annual == $_POST['eventtype']){ ... do stuff ... } elseif(OneTime == $_POST['eventtype']){ ... do other stuff ... } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] radio buttons checked or not
From: Andy B [EMAIL PROTECTED] i have this code: ?if($old['Type']==Annual){? input type=radio name=eventtype value=Annualchecked accesskey=yYes ?}else {? input type=radio name=eventtype value=OneTime checked accesskey=nNo?}? was just wondering if that was the right way to determine the state of a radio button...? if the value of $old['Type']=Annual then the yes button is checked...if not then the no button is checked instead... Assuming $old['Type'] somehow comes from $_REQUEST['eventtype'] (or is related to it), then yeah, that'll work. Another way: $checked[$old['Type']] = ' checked'; echo input type=\radio\ name=\eventtype\ value=\Annual\ {$checked['Annual']}Yes; echo input type=\radio\ name=\eventtype\ value=\OneTime\ {$checked['OneTime']}No; This method works even better when you have an array('Annual' = 'Yes', 'OneTime' = 'No') that you use to build the checkboxes. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] radio buttons checked or not
Assuming $old['Type'] somehow comes from $_REQUEST['eventtype'] (or is related to it), then yeah, that'll work. no its coming from a db result from fetch_array() of which im having an interesting problem with right now but thats in another post -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] radio buttons checked or not
My understanding is if the variable exists then the radio button was checked. i have this code: ?if($old['Type']==Annual){? input type=radio name=eventtype value=Annualchecked accesskey=yYes ?}else {? input type=radio name=eventtype value=OneTime checked accesskey=nNo?}? was just wondering if that was the right way to determine the state of a radio button...? if the value of $old['Type']=Annual then the yes button is checked...if not then the no button is checked instead... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] radio buttons checked or not
- Original Message - From: Daniel Clark [EMAIL PROTECTED] To: Andy B [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Wednesday, April 07, 2004 4:22 PM Subject: Re: [PHP] radio buttons checked or not My understanding is if the variable exists then the radio button was checked. i have this code: ?if($old['Type']==Annual){? input type=radio name=eventtype value=Annualchecked accesskey=yYes ?}else {? input type=radio name=eventtype value=OneTime checked accesskey=nNo?}? was just wondering if that was the right way to determine the state of a radio button...? if the value of $old['Type']=Annual then the yes button is checked...if not then the no button is checked instead... nope..its pulled out of a db... its a field name called Type and its ENUM ('Annual', 'OneTime') and i have to load all of the record back into the form so it can be changed and put back into the table -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php