Xtremer360 Posted November 5, 2012 Share Posted November 5, 2012 (edited) I'm trying to figure out why I am receiving a t_if error when my page loads? <?php foreach($title_statuses AS $status) { if (isset($title_data)) { $selected = $title_data->title_status_id === $status->title_status_id ? ' selected="selected"' : ''; } echo '<option value="'.$status->title_status_id.'"'. if (isset($selected)) { echo $selected; } .'>'.$status->title_status_name.'</option>'; } ?> Edited November 5, 2012 by Xtremer360 Quote Link to comment https://forums.phpfreaks.com/topic/270330-unexpected-t_if/ Share on other sites More sharing options...
Xtremer360 Posted November 5, 2012 Author Share Posted November 5, 2012 (edited) After thinking about it I came up with this and it worked. <?php foreach($title_statuses AS $status) { if (isset($title_data)) { $selected = $title_data->title_status_id === $status->title_status_id ? ' selected="selected"' : ''; } echo '<option value="'.$status->title_status_id.'"'; if (isset($selected)) { echo $selected; } . echo '>'.$status->title_status_name.'</option>'; } ?> Edited November 5, 2012 by Xtremer360 Quote Link to comment https://forums.phpfreaks.com/topic/270330-unexpected-t_if/#findComment-1390401 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.