Conditional statement inside string inside php
问题 I am trying to evaluate date[3] to determine selected option. All this is inside a php sql query. I am not able to find out an easy way to get a selected for the value returned in date[3] in my $options string variable. <?php //sql statement foreach( $db->query($sql) as $data ) { $options = "<select type='text' name='pagephone' select id='pagephone' > <option value=''></option> <option ". if ($data[3] == 'vtext.com' ){ echo 'selected' };. " value='vtext.com'>Verizon Wireless</option> <option