Jump to content


Photo

href html tag output trouble (Newbie)


  • Please log in to reply
2 replies to this topic

#1 leonthelion

leonthelion
  • New Members
  • Pip
  • Newbie
  • 8 posts

Posted 21 June 2006 - 05:32 PM

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/se...send/d.php?id=" title"File">http://domain.com/se...><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...

#2 Buyocat

Buyocat
  • Members
  • PipPipPip
  • Advanced Member
  • 267 posts

Posted 21 June 2006 - 05:47 PM

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.
Looking for some easy-to-use tools?  Try these, https://sourceforge....jects/utils-php -- I made them myself.  They're distinct tools which are easy to understand and use.  See some examples uses at http://www.anotherearlymorning.com

#3 leonthelion

leonthelion
  • New Members
  • Pip
  • Newbie
  • 8 posts

Posted 27 June 2006 - 06:15 AM

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>






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users