Shadowing Posted June 7, 2012 Share Posted June 7, 2012 Hey guys ive hit a wall trying to return this as a string. not sure what to do about the "'" issue. [php $return = " <option value='-43200' $time_offset == '-43200' ? 'selected="selected"' : ''; >(GMT -1200) national </option> <option value='-39600' $time_offset == '-39600' ? 'selected="selected"' : ''; >(GMT -1100) Samoa </option> <option value='-36000' $time_offset == '-36000' ? 'selected="selected"' : ''; >(GMT -1000) Hawaii </option> "; echo json_encode(array("display" => $return)); [/code] Quote Link to comment Share on other sites More sharing options...
shelestov Posted June 7, 2012 Share Posted June 7, 2012 $return = '<option value="-43200" ' . ($time_offset == '-43200' ? 'selected="selected"' : '') . '>(GMT -1200) national</option>'; Quote Link to comment Share on other sites More sharing options...
Shadowing Posted June 7, 2012 Author Share Posted June 7, 2012 thanks shelestove I wasn't aware of how to concatenate a ternery in a string Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.