Page 1 of 1
I need an example of how to add an url link
Posted: Tue Jan 22, 2008 7:58 pm
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
Re: I need an example of how to add an url link
Posted: Tue Jan 22, 2008 8:09 pm
by John Cartwright
Code: Select all
echo '<a href="http://domain.com">my link</a>';
?
Re: I need an example of how to add an url link
Posted: Tue Jan 22, 2008 8:27 pm
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
Re: I need an example of how to add an url link
Posted: Tue Jan 22, 2008 9:40 pm
by John Cartwright
Yes, all echo does is output the string to the browser, whatever that may be.
Re: I need an example of how to add an url link
Posted: Tue Jan 22, 2008 9:42 pm
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.