Jump to content
Updating IPB tonight Read more... ×


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


href html tag output trouble (Newbie)

Recommended Posts

The link text is displaying the right link, but the href tag underneath is truncating...

the following code:

[!--fonto:Courier New--][span style=\"font-family:Courier New\"][!--/fonto--] <a href=\"http://".$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF'])."/d.php?id=".$file."\" title\"File\">http://".$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF'])."/d.php?id=".$_COOKIE["file"]."</a><br><br><br></td></tr>

is generating the following html source:

[!--fonto:Courier New--][span style=\"font-family:Courier New\"][!--/fonto--] <a href="http://domain.com/send/jap/send/d.php?id=" title"File">http://domain.com/send/jap/send/d.php?id=2306d47066299f8cb5f380c4c4435c98</a><br><br><br></td></tr>

As you can see, some formatting in the above code is being interpreted against my wishes. If I can only get the href to match the link text, it will work.

I'm quite sure it's a simple syntax error, but can't find which part...

Share this post

Link to post
Share on other sites
You have one incredibly long link there! At any rate I strongly suggest assigning it to a variable then doing this:
<a href="$link_url">Click Me</a>
You can have your lengthy url that way and avoid some of the problems with quotes inside quotes, so:
$link_url = 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . '/d.php?id=' . $file ...
I'm not sure what you did after the $file, what with the \ 's I was a little confused. At any rate you should be able to keep concatenating forever.

Share this post

Link to post
Share on other sites
Thank you for your help.

That solved the problem, but I needed to include the trailing code, so my end result was:

$link_url = 'http://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']).'/d.php?id='.$_COOKIE["file"];

and then

<a href='$link_url'>some text</a>

Share this post

Link to post
Share on other sites


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.