Jump to content

[SOLVED] using php within a link within php


runnerjp

Recommended Posts

ok i did this

 

<?php  if($gettopic3['forumlock'] == 0)
{
    echo "<a href='index.php?page=reply&id={$id}'><img src="http://www.runningprofiles.com/images/post_reply.gif" border="0"  />[/url]";
}
else
{
    echo 'forum is locked';
} ?>

and i got expecting '' of ; for  echo "<a href='index.php?page=reply&id={$id}'><img src="http://www.runningprofiles.com/images/post_reply.gif" border="0" 

You need to escape any double quotes within a string which starts/ends in double quotes.

<?php  if($gettopic3['forumlock'] == 0)
{
    echo "<a href=\"index.php?page=reply&id=$id\"><img src=\"http://www.runningprofiles.com/images/post_reply.gif\" border=\"0\"  /></a>";
}
else
{
    echo 'forum is locked';
}
?>

you have to escape the inner " because otherwise PHP thinks you want to end your string. change " to \" like this:

 

 

<?php  if($gettopic3['forumlock'] == 0)
{
    echo "<a href='index.php?page=reply&id={$id}'><img src=\"http://www.runningprofiles.com/images/post_reply.gif\" border=\"0\"  />[/url]";
}
else
{
    echo 'forum is locked';
} ?>

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.