wilna Posted March 25, 2010 Share Posted March 25, 2010 Hi I would just like to know what is the difference between: <a href=mrt10.php?echo $session><font face=Arial size=2>March</a> and <a href=mrt10.php><font face=Arial size=2>March</a> Link to comment https://forums.phpfreaks.com/topic/196459-echo-session/ Share on other sites More sharing options...
developerdave Posted March 25, 2010 Share Posted March 25, 2010 well firstly, the top example contains some PHP, but it won't run because its not wrapped in <?php ?> if you wanted that to work it would need to be <a href="mrt10.php?<?php echo $session; ?>"><font face="Arial" size="2">March</a> And it will add whatever $session is equal too into that link. And if it contains nothing, you'll see no difference. And the bottom example is just plain old HTML lol Link to comment https://forums.phpfreaks.com/topic/196459-echo-session/#findComment-1031544 Share on other sites More sharing options...
wilna Posted March 25, 2010 Author Share Posted March 25, 2010 ok sorry my mistake, let me try again: <?php echo "<a href=mrt10.php?echo $session><font face=Arial size=2>March</a>"; ?> and <?php echo "<a href=mrt10.php><font face=Arial size=2>March</a>"; ?> Link to comment https://forums.phpfreaks.com/topic/196459-echo-session/#findComment-1031571 Share on other sites More sharing options...
developerdave Posted March 25, 2010 Share Posted March 25, 2010 The top example will raise an error, take the echo out of the middle of the line like this (I've also encapsulated it for you) <?php echo "<a href=mrt10.php?{$session}><font face=Arial size=2>March</a>"; ?> Link to comment https://forums.phpfreaks.com/topic/196459-echo-session/#findComment-1031572 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.