Html and the echo statement

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
lynchpin
Forum Commoner
Posts: 60
Joined: Mon Jul 21, 2008 1:31 pm

Html and the echo statement

Post by lynchpin »

Hello

I am pulling my hair out on this one, I am wondering if its wamp server 5 or its just me. I want to know why this statment wouldn't work.

<a href="<?php echo 'some address'; ?>" >Address</a>

The link appears but appears something like this -- http://localhost/some_path/<?php echo 'some address'; ?>
instead of -- http://localhost/some_path/some address

Thanks.
User avatar
aceconcepts
DevNet Resident
Posts: 1424
Joined: Mon Feb 06, 2006 11:26 am
Location: London

Re: Html and the echo statement

Post by aceconcepts »

Will 'some address' be a variable or a string?

Code: Select all

<a href="<?php echo 'some address'; ?>" >Address</a>
The above would output as Address with the link being "some address".
lynchpin
Forum Commoner
Posts: 60
Joined: Mon Jul 21, 2008 1:31 pm

Re: Html and the echo statement

Post by lynchpin »

Its just a string, but i might want to use variables or even return values from functions.
mintedjo
Forum Contributor
Posts: 153
Joined: Wed Nov 19, 2008 6:23 am

Re: Html and the echo statement

Post by mintedjo »

Just checking, but:
- Do you definately have php installed?
- Is the page you are building saved with .php file extension?
lynchpin
Forum Commoner
Posts: 60
Joined: Mon Jul 21, 2008 1:31 pm

Re: Html and the echo statement

Post by lynchpin »

Yeah I do :D . I have found the problem, I was trying to run code written for php 3.

Thanks alot guyz.
Post Reply