Jump to content

href html tag output trouble (Newbie)


leonthelion

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>
<tr>[!--fontc--][/span][!--/fontc--]

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>
[!--fontc--][/span][!--/fontc--]

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...
Link to comment
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.
Link to comment
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>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.