leonthelion Posted June 21, 2006 Share Posted June 21, 2006 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... Quote Link to comment https://forums.phpfreaks.com/topic/12564-href-html-tag-output-trouble-newbie/ Share on other sites More sharing options...
Buyocat Posted June 21, 2006 Share Posted June 21, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/12564-href-html-tag-output-trouble-newbie/#findComment-48139 Share on other sites More sharing options...
leonthelion Posted June 27, 2006 Author Share Posted June 27, 2006 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> Quote Link to comment https://forums.phpfreaks.com/topic/12564-href-html-tag-output-trouble-newbie/#findComment-49970 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.