Jump to content

Is this short form if else valid?


scrubbicus

Recommended Posts

$selected = ( $select_value ) ? ( ($row['id'] == $select_value) ? 'selected' : ' ' ) : ' ';

 

I suppose it is since I'm not getting an error but I don't believe it's doing what I think it should do. I want to set $selected depending on if $select_value is TRUE or FALSE, if it is TRUE I want to then check if it's the same as the row id we're currently in with the SQL loop, if it is, set it to 'selected' if not then nothing.

Link to comment
https://forums.phpfreaks.com/topic/184865-is-this-short-form-if-else-valid/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.