PHP variables?
Posted by: Davil (---.dsl.netsource.ie)
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

Hi,

now it's blank. I don't understand. I've uploaded my wamp PHPinfo to
[www.irishthoracicsociety.com]

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.

Options: ReplyQuote
Re: PHP variables?
Posted by: AustinW (---.dsl.irvnca.pacbell.net)
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 "

Options: ReplyQuote
Re: PHP variables?
Posted by: Davil (---.nehb.ie)
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

Options: ReplyQuote


Sorry, only registered users may post in this forum.