Jump to content

Unexpected T_If


Xtremer360

Recommended Posts

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

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

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.