Includes, links

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
User avatar
evilmonkey
Forum Regular
Posts: 823
Joined: Sun Oct 06, 2002 1:24 pm
Location: Toronto, Canada

Includes, links

Post 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!
User avatar
Zoram
Forum Contributor
Posts: 166
Joined: Sun Aug 18, 2002 3:28 pm
Location: Utah
Contact:

Post by Zoram »

try :

include ("include.php");
<a href=" <?php echo($index); ?> ">homepage</a>
oldtimer
Forum Contributor
Posts: 204
Joined: Sun Nov 03, 2002 8:21 pm
Location: Washington State

Post 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
User avatar
evilmonkey
Forum Regular
Posts: 823
Joined: Sun Oct 06, 2002 1:24 pm
Location: Toronto, Canada

Post by evilmonkey »

Thanks, that worked.

Cheers!
Post Reply