Radio Button

Helpdesk for my helpdesk software

Moderator: mkoch227

Post Reply
steve
Posts: 147
Joined: Tue Mar 27, 2012 9:32 pm

Radio Button

Post 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?
-Steve
Klemen
Site Admin
Posts: 10145
Joined: Fri Feb 11, 2005 4:04 pm

Re: Radio Button

Post 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
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
steve
Posts: 147
Joined: Tue Mar 27, 2012 9:32 pm

Re: Radio Button

Post by steve »

Thanks
-Steve
Post Reply