Page 1 of 1

Includes, links

Posted: Mon Feb 10, 2003 6:05 pm
by evilmonkey
Hello.

I have a file called include.php. Say, this is it's contents:

Code: Select all

$index='http://www.mysite.com/index.php';
and on some other page on my website I put:

Code: Select all

include ("include.php");
<a href=" <?php $index ?> ">homepage</a>
This doesn't work. Can someone please tell me why? Is it because something is wrong with the quotes? I think I tried all variations. In any event, thanks.

Cheers!

Posted: Mon Feb 10, 2003 6:07 pm
by Zoram
try :

include ("include.php");
<a href=" <?php echo($index); ?> ">homepage</a>

Posted: Mon Feb 10, 2003 6:29 pm
by oldtimer
Yes. You just can not put that string in. You have to echo it out so that it really prints it value in that spot.

Jerry

Posted: Mon Feb 10, 2003 8:31 pm
by evilmonkey
Thanks, that worked.

Cheers!