PHP picture inside if statement
by Robert Teixiera on Jul 26, 2012 at 4:03:40 am
Ok totally unfair, complete newbe here.
I thought it would be easy to start with a simple if statement. The idea is to rotate a website opening banner depending on the month, but I can't even get it to display a simple JPG.
I took a working if statement, and inserted a working picture, but it give me:
syntax error, unexpected '<'
I am trying to stay away from PHP specific ways to show a JPG if possible, as I like the insert picture as .PSD dreamweaver does.
As an interesting side note, if I cut the link out and use an include containing this exact code, it works perfectly. (guess I could have 4 or 5 different include pages, but I'm trying understand what is happening.)
note on the second one that you have to escape the quotes inside the echo statement so that you avoid a parse error - a simpler example:
echo "this is in \"quotes\" here";
an alternative is to use single quotes for the echo, but you can run into issues there too...as for closing php blocks and using standard html vs doing a php echo, that is personal preference...either one is "correct" technically...