PHP variables?
Posted by: Davil (
Date: December 19, 2005 07:52PM

I have a simple question, I'm new to all this but it seems simple enough. I have some php from a book I bought and it looks perfect, and it works on a webserver - I was able to test it. but when trying to do this on wamp, the variables are either showing up as for example

Hi , $username

when it should really be Hi, Davil or whatever.
now I changed the PHP opening tag from <? to <?PHP and this gave me


now it's blank. I don't understand. I've uploaded my wamp PHPinfo to

please check this out and tell me what I'm doing wrong. I've tried adding some entries to php.ini that people have suggested such as error_reporting and register_globals but still no luck. any help is much appreciated as I have a project to do and I need WAMP or similar to do it.

Re: PHP variables?
Posted by: AustinW (
Date: December 20, 2005 03:17AM

Umm first of all, your page needs to end in .php extension. Second, make sure you're using your echo statement correctly.

$username = 'bob';
echo('Hi, $username'); //prints: Hi, $username
echo("Hi, $username"winking smiley; //prints Hi, bob
echo('Hi, '.$username); //prints Hi, bob

make sure you use your quotes correctly, I prefer ' but some prefer "

Re: PHP variables?
Posted by: Davil (
Date: December 20, 2005 03:29PM

yes I'm using .php extension,
was using the print command rather than echo, will that make a difference? This code works fine on my webserver but not on wamp

Sorry, only registered users may post in this forum.