JavaScript template code inside PHP -
i have template system gets info table of database. example <%=flight.flightnum%>
shows flight number. it's made way parse info javascript popup window on google map.
i want able add inside php code error getting parse error: syntax error, unexpected '<' on line 137
.
line 137 is.
if((<%=flight.flightnum%> > 3000) && (<%=flight.flightnum%> < 3499))
i assuming doesn't template code inside php tags. how can put them inside php tags? thinking pass javascript output php variable $flight
or something, possible?
this code want achieve.
<?php if((<%=flight.flightnum%> > 3000) && (<%=flight.flightnum%> < 3499)) { echo '<center><img src="'.site_url.'/lib/skins/airline/images/divisions/regional.png"></center><br/>'; } else if((<%=flight.flightnum%> > 9900) && (<%=flight.flightnum%> < 9999)) { echo '<center><img src="'.site_url.'/lib/skins/airline/images/divisions/cargo.png"></center><br/>'; } else { echo '<center><img src="'.site_url.'/lib/skins/airline/images/divisions/main.png"></center><br/>'; } ?>
Comments
Post a Comment