Jump to content

Archived

This topic is now archived and is closed to further replies.

sofaman

undefined variable _post and _server

Recommended Posts

I'm new to php, I'm learning from a book at the minute.

I'm running:
apache web server 2.0.59
PHP 5.0.2
Mysql 5.0.24 (as a module not cgi)

The same versions as what the book uses.

I've installed a forum - no problems
I've created a database useing the cmd line
I can view the database in IE
When I try to 'insert' into the database via IE I get the following

with code:
if ($_post) {
  // create empty error variable
  $msg = "";

I receive undefined variable _post

so I tried :
<?
$browser = $_server['php_shelf'];
echo "the sniffer says: $browser" ;
?>

I get undefined variable _server

I've search here and php.net, I've looked through php.ini but not found anything I think might work

Please help

cheers

sofa

Share this post


Link to post
Share on other sites
you have to use upper case with those matey!!!

and PHP_SELF (not php_shelf) not seen shelf anywhere ;)
try this..

[code]
<?php
if ($_POST) {
  // create empty error variable
  $msg = "";

I receive undefined variable _post

so I tried :
<?
$browser = $_SERVER['PHP_SELF'];
echo "the sniffer says: $browser" ;
?>
[/code]

NOTE: try not use short tags '<?' use '<?php' instead - and turn off teh short tags in your php.ini file otherwise any xml files will reek havoc!

ALSO $_SERVER['PHP_SELF'] returns the name of name of the current script NOT the browser (or user agent) check the manula for the super globals info....

Share this post


Link to post
Share on other sites
Thank you so much they work a treat :D
I've never programmed where I NEEDED to use uppercase. I must of missed the part in the book :(

I think I will do the tutorials from this site next.

Thanks again :D

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.