Jump to content


Photo

echoing link code


  • Please log in to reply
10 replies to this topic

#1 CircularStopSign

CircularStopSign
  • Members
  • PipPipPip
  • Advanced Member
  • 44 posts

Posted 04 September 2006 - 05:38 AM

in PHP how do i echo something so it says the code for a link? i tried but it says unexpected '<' in line 89... :(

#2 Ifa

Ifa
  • Members
  • PipPipPip
  • Advanced Member
  • 88 posts
  • LocationRauma, Finland

Posted 04 September 2006 - 05:41 AM

echo '<a href="...">...</a>';
I'm just a guy who likes to code for fun...

#3 radar

radar
  • Members
  • PipPipPip
  • Advanced Member
  • 645 posts
  • LocationSLC

Posted 04 September 2006 - 05:43 AM

Show me how you tried to do it and I'll tell you your problem...  To echo a link this is how you would do it...
<?php
echo '<a href="what">what what</a>';
?>

if you have something different to do that -- id change it..



#4 CircularStopSign

CircularStopSign
  • Members
  • PipPipPip
  • Advanced Member
  • 44 posts

Posted 04 September 2006 - 05:48 AM

well i want it to echo so it says the actual code for the link, not just the unerlined link itself

#5 radar

radar
  • Members
  • PipPipPip
  • Advanced Member
  • 645 posts
  • LocationSLC

Posted 04 September 2006 - 06:00 AM

ahh.. lemme do a test right quick... and i'll get back with you..

#6 CircularStopSign

CircularStopSign
  • Members
  • PipPipPip
  • Advanced Member
  • 44 posts

Posted 04 September 2006 - 06:05 AM

ok haha thanks

#7 venkateshinbox

venkateshinbox
  • Members
  • PipPip
  • Member
  • 10 posts
  • LocationIndia

Posted 04 September 2006 - 08:26 AM

How abt this one?

$a = "<a href=abc.php>test</a>";
echo $a;


Visit my online portfolio - www.phpdevteam.com

also, my recent web aggregator - www.liteboy.com

#8 radar

radar
  • Members
  • PipPipPip
  • Advanced Member
  • 645 posts
  • LocationSLC

Posted 04 September 2006 - 08:46 AM

Well since the syntax of the link itself is wrong -- it might work..  though if the syntax was right it wouldn't.. it would process the html.. see problem is gotta figure out how to make the html not process...

#9 Jenk

Jenk
  • Members
  • PipPipPip
  • Advanced Member
  • 778 posts

Posted 04 September 2006 - 08:47 AM

<?php echo htmlentities('<a href="http://www.example.com/">link</a>'); ?>


#10 radar

radar
  • Members
  • PipPipPip
  • Advanced Member
  • 645 posts
  • LocationSLC

Posted 04 September 2006 - 08:50 AM

ahh a new function.. havent seen this one before *heads to php.net for some reading*

#11 CircularStopSign

CircularStopSign
  • Members
  • PipPipPip
  • Advanced Member
  • 44 posts

Posted 04 September 2006 - 02:53 PM

alright guys, this is finally what iput down and it works. thanks guys

if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
    echo htmlentities('<a href="http://www.hostmapics.com/"><img src="http://hostmapics.com/'); 
echo $target_path; 
echo htmlentities('"></a>');
} else{
    echo "There was an error uploading the file, please try again!";
}





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users