Xtremer360 Posted November 5, 2012 Share Posted November 5, 2012 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>'; } ?> 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 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>'; } ?> Link to comment https://forums.phpfreaks.com/topic/270330-unexpected-t_if/#findComment-1390401 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.