View Full Version : HELP PHP Stuck!
MetroMint
08-04-2012, 08:11 PM
Right so this is my code -
<?php echo '- <a class="red_link" href="irl/viewProfile.php?id=' . $_SESSION['id'] . '">My Profile</a>'; ?>
This is what I want it to look like -
<?php echo '- <a class="red_link" href="javascript:ajaxpage('irl/viewProfile.php?id=' . $_SESSION['id'] . ', 'mid');'">My Profile</a>'; ?>
This is the error -
Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in lala/the/url/was/here on line 38
Many Thanks!
Instead of using $_SESSION['id'] all the time it's easier to put it into a variable.
$id = $_SESSION['id']
I have no idea what's gone wrong in your echo sorry :(
Blinger
08-04-2012, 08:28 PM
Right so this is my code -
<?php echo '- <a class="red_link" href="irl/viewProfile.php?id=' . $_SESSION['id'] . '">My Profile</a>'; ?>
This is what I want it to look like -
<?php echo '- <a class="red_link" href="javascript:ajaxpage('irl/viewProfile.php?id=' . $_SESSION['id'] . ', 'mid');'">My Profile</a>'; ?>
This is the error -
Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in lala/the/url/was/here on line 38
Many Thanks!
You need to escape the ' marks on ajaxpage( ?
MetroMint
08-04-2012, 08:40 PM
Instead of using $_SESSION['id'] all the time it's easier to put it into a variable.
$id = $_SESSION['id']
I have no idea what's gone wrong in your echo sorry :(
Yeah thats the only one
You need to escape the ' marks on ajaxpage( ?
Yeah I do that I just missed the code as I typed it out on here not copied
MetroMint
08-04-2012, 09:38 PM
Fixed mod close please!
Jonster
08-04-2012, 09:41 PM
Why don't you just echo the session ID instead of it all?
<a class="red_link" href="javascript:ajaxpage('irl/viewProfile.php?id=<?php echo $_SESSION['id'];?>, 'mid')">My Profile</a>
If that isn't suitable, then it appears you've got a ; and ' (marked red) that you don't need.
<?php echo '- <a class="red_link" href="javascript:ajaxpage(\'irl/viewProfile.php?id=' . $_SESSION[\'id'] . ', \'mid\');'">My Profile</a>'; ?>
tyr0ne
09-04-2012, 04:00 PM
Try this
<?php echo '- <a class="red_link" href="javascript:ajaxpage(\'irl/viewProfile.php?id=' . $_SESSION[id] . '\', \'mid\');">My Profile</a>'; ?>
Want to hide these adverts? Register an account for free!
Powered by vBulletin® Version 4.2.5 Copyright © 2026 vBulletin Solutions Inc. All rights reserved.