Reputation: 217
when I give
<? echo $submissiontype ?>
I am getting the output as
PRIORITY
but for the below code, i am expecting the output as
selected
but I can't get it,
<? if($submissiontype == 'PRIORITY') {echo 'selected';} ?>
what is the mistake in the above code ?
Upvotes: 0
Views: 42
Reputation: 378
You can also use string compare, strcmp
if(!strcmp($submissiontype," PRIORITY")) {
echo "selected";
}
Upvotes: 0
Reputation: 7801
What if you trim $submissionType
type first.
<? if(trim($submissiontype) == 'PRIORITY') {echo 'selected';} ?>
Often there are whitespaces that we don't account for.
Upvotes: 3