if statement problems
I'm trying to get an if statement to work in the following way.
I need the script to realise if value is between say 1 and 2 and return a checked radio button.
I can get the radio button to be check if the value equals 1 using the code below
<?php if($average_communication_rating == '1'){ echo 'checked="checked"';} ?>
I can't get it to work if the value is between 1 and 2, I was trying to use the following but I keep getting these errors
<?php if($average_communication_rating => '1' AND < '2'){ echo 'checked="checked"';} ?>
I think this is something that should be ffairly easy to sort out but I can't seem to fix it at all.
Any help would be much appreciated.
Thanks
@php.net
<?php if($average_communication_rating >= '1' AND $average_communication_rating <= '2'){ echo 'checked="checked"';} ?>
(Note: the checkbox will be checked if the value is 2.)
SitePoint Enthusiast
the logic operators always have the > or < first >=, <=
Great thanks for sorting this out for me!
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Bookmarks