Page 1 of 1

Unable to echo variables

Posted: Sun May 19, 2002 5:54 pm
by tim wehr
I have 25 years experience as a programmer, but only 25 MINUTES experience with PHP and MySQL.

Just installed both on Mac OS X 10.1.4. The DB seems to be working fine. My problem is with PHP.

After install, I did the usual test with

Code: Select all

<?php phpinfo(); ?>
Works fine.

Then tested with

Code: Select all

<?php echo $HTTP_USER_AGENT; ?>

and it produces nothing.

Also tried the following:

Code: Select all

<?php 
	if(strstr($HTTP_USER_AGENT, "MSIE"))
		echo "You are using Internet Explorer<br>";
	else
		echo "You are NOT using Internet Explorer<br>" ?>
and it echos "You are NOT using Internent Explorer" (but I am).

Also tried a brief example from a form and it did not echo the form contents.

Why is it not echoing variables?

Posted: Sun May 19, 2002 6:21 pm
by volka
may be your're using php 4 with register_globals=off
try

Code: Select all

print($_SERVER&#1111;'HTTP_USER_AGENT']);

That's It

Posted: Sun May 19, 2002 6:31 pm
by tim wehr
Thanks! That make it work. I'll have to read more to see how that relates to the forms, etc.

Appreciate the help!

Posted: Sun May 19, 2002 6:32 pm
by volka
most of it is described here