I need an example of how to add an url link

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
meese
Forum Newbie
Posts: 2
Joined: Tue Jan 22, 2008 7:37 pm

I need an example of how to add an url link

Post by meese »

Hello everyone,
I have been asked to add an url link into an existing .php file. I have some background in php but it is rusty. I searched and did not really see an example of how to insert a line of code for a url link. Could someone direct me to an example that explaines what is being done so that I can learn as well as get this task assigned to me completed? :?

Thanks in advance for any and all help!!
meese
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Re: I need an example of how to add an url link

Post by John Cartwright »

Code: Select all

echo '<a href="http://domain.com">my link</a>';
?
meese
Forum Newbie
Posts: 2
Joined: Tue Jan 22, 2008 7:37 pm

Re: I need an example of how to add an url link

Post by meese »

Thank you jcart!

Code: Select all

echo '<a href="http://domain.com">my link</a>';
I see that the code is primarily the html code with single quotes and a semicolon...those things I unerstand, then I guess that the echo puts the link on the web page?

Thank you for the help!!
meese
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Re: I need an example of how to add an url link

Post by John Cartwright »

Yes, all echo does is output the string to the browser, whatever that may be.
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: I need an example of how to add an url link

Post by califdon »

meese wrote:Thank you jcart!

Code: Select all

echo '<a href="http://domain.com">my link</a>';
I see that the code is primarily the html code with single quotes and a semicolon...those things I unerstand, then I guess that the echo puts the link on the web page?

Thank you for the help!!
meese
Keep in mind that all the PHP is doing is generating HTML to be sent to the browser. You can mix plain HTML and PHP in the same file on the server if:
(1) the file has an extension of .php or whatever your web server recognizes in order to preprocess the PHP code before sending the result to the browser; and
(2) all PHP code is enclosed between
<?php
and
?>
tags.
Post Reply