Page 1 of 1

Html and the echo statement

Posted: Wed Nov 26, 2008 4:48 am
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.

Re: Html and the echo statement

Posted: Wed Nov 26, 2008 5:03 am
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".

Re: Html and the echo statement

Posted: Wed Nov 26, 2008 5:06 am
by lynchpin
Its just a string, but i might want to use variables or even return values from functions.

Re: Html and the echo statement

Posted: Wed Nov 26, 2008 5:47 am
by mintedjo
Just checking, but:
- Do you definately have php installed?
- Is the page you are building saved with .php file extension?

Re: Html and the echo statement

Posted: Wed Nov 26, 2008 5:54 am
by lynchpin
Yeah I do :D . I have found the problem, I was trying to run code written for php 3.

Thanks alot guyz.