470,815 Members | 1,329 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,815 developers. It's quick & easy.

embedded HTML in php code with 5.1.1

would anyone please tell me why this code works in 4.X, 5.0.X and not in
5.1?

<?php
function myfunction(){

*** php code ***
?>
<a href="bla.bla">bla</a>
<?
*** php code ***

}

?>

when i run it under 5.1 i get the error "Parse error: syntax error,
unexpected $end in" on the last line of the file. i drop the embedded
html and it works fine.

i know doing it this way is kinda sloppy and on my list of things to
fix, but that can't be done right now. is there some setting in 5.1
where i can turn this back on or do i have to downgrade to 5.0 again.

thanks
willie
Jan 12 '06 #1
1 1510
NC
Bob Marley wrote:
would anyone please tell me why this code works in 4.X, 5.0.X
and not in 5.1?

<?php
function myfunction(){

*** php code ***
?>
<a href="bla.bla">bla</a>
<?
*** php code ***

}

?>

when i run it under 5.1 i get the error "Parse error: syntax error,
unexpected $end in" on the last line of the file. i drop the embedded
html and it works fine.


Most likely, it has nothing to do with PHP version, but rather with
your use of "<?" opening tag. Change it to "<?php" and see if it
solves the problem. If it does, it means your short_open_tag directive
is set to 0 and you must either change all "<?" tags to "<?php" tags or
set short_open_tag to 1.

Cheers,
NC

Jan 12 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Aquarius2431 | last post: by
6 posts views Thread by Moist | last post: by
26 posts views Thread by jini us | last post: by
6 posts views Thread by Shalini | last post: by
2 posts views Thread by Owen.Leibman | last post: by
30 posts views Thread by =?ISO-8859-1?Q?Tom=E1s_=D3_h=C9ilidhe?= | last post: by
reply views Thread by mihailmihai484 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.