php - When eching, i get error because of if -


this question has answer here:

im creating option if, because if need on load item b selected current view. dont need js. trying this, error because of if, done right think here is:

echo ('<option value="?m=ticketsmith&ticket_company=' . $row['company_id'] . '&type='.$type.'"'. if ($show_uid == $row['company_id']) { echo ' selected="selected"';}'/>' . $row['company_id'].', ' . $row["company_name"]) ; 

i hope guys me. , here error messege: parse error: syntax error, unexpected 'if' (t_if) in

echo ('<option value="?m=ticketsmith&ticket_company=' . $row['company_id'] . '&type='.$type.'"'.  ($show_uid == $row['company_id'] ? ' selected="selected"' : '' ) . '/>' . $row['company_id'].', ' . $row["company_name"]) ; 

the change this

if ($show_uid == $row['company_id']) { echo ' selected="selected"';} 

to this

($show_uid == $row['company_id'] ? ' selected="selected"' : '' ) 

Comments