Page 1 of 1
Format this!
Posted: Sat Nov 19, 2005 3:48 pm
by mhouldridge
Hi,
I have the following code, which I cannot format to work.
Code: Select all
echo "Welcome ".$_SESSION['first_name'." ".$_SESSION['last_name']."<img src="images/1x1.gif" width="10"><a href="user_logout.php" class="10">Logout</a>';
I dont quite get the formatting side yet for html.
PLease help
Posted: Sat Nov 19, 2005 4:08 pm
by m3mn0n
You're missing a bracket on the first SESSION variable and you need to escape the double quotes if you're echoing with double quotes. And when you start an echo/print, make sure to finish it off with the same quote type. Single/Single or Double/Double, not Double/Single.
Posted: Sat Nov 19, 2005 4:13 pm
by John Cartwright
Posted: Sat Nov 19, 2005 4:13 pm
by php3ch0
The code you need is:
Code: Select all
echo "Welcome ".$_SESSION['first_name']." ".$_SESSION['last_name']."<img src='images/1x1.gif' width='10'><a href='user_logout.php' class='10'>Logout</a>";
Posted: Sat Nov 19, 2005 4:18 pm
by Chris Corbyn
If you're not already using an editor that does highlighting it might be an idea. Spotting mistakes like not escaping quotes sticks out like a sore thumb if you use one

Posted: Sat Nov 19, 2005 4:19 pm
by m3mn0n
True. Syntax highlighting is very useful.
Posted: Sat Nov 19, 2005 4:27 pm
by John Cartwright
Sami wrote:True. Syntax highlighting is very useful.
'
To some people, to others it is nothing more than a distraction

Posted: Sat Nov 19, 2005 4:29 pm
by Chris Corbyn
We're going off-topic here (my fault again

) but if you use something like emacs you can turn highlighting on and off with just a few simple key presses. You can also stop it highlighting and simply do the bracket pairing. The rest of the time you can have plain old emacs.