Page 1 of 1

Radio Button

Posted: Fri May 04, 2012 10:48 pm
by steve

Code: Select all

<input type="radio" name="custom10" value="1" <?php if ($ticket['custom10'] = 1) {echo 'checked="checked"';} ?> /> Yes 
<input type="radio" name="custom10" value="" <?php if ($ticket['custom10'] = 1 ) {echo '';} ?> /> No
If custom10 = 1 then radio yes is selected
if custom10 = null then radio no is selected

What am i missing here?

Re: Radio Button

Posted: Sat May 05, 2012 6:02 am
by Klemen
You need to use two "=" to compare, one just assigns a value.

$a == 1 (compares $a to 1)
$a = 1 (sets $a to 1)

http://php.net/manual/en/language.opera ... arison.php

Re: Radio Button

Posted: Sat May 05, 2012 7:32 am
by steve
Thanks