Unable to echo variables

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
tim wehr
Forum Newbie
Posts: 4
Joined: Sun May 19, 2002 5:54 pm

Unable to echo variables

Post 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?
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

may be your're using php 4 with register_globals=off
try

Code: Select all

print($_SERVER&#1111;'HTTP_USER_AGENT']);
tim wehr
Forum Newbie
Posts: 4
Joined: Sun May 19, 2002 5:54 pm

That's It

Post 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!
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

most of it is described here
Post Reply