Jump to content


Photo

undefined variable _post and _server


  • Please log in to reply
2 replies to this topic

#1 sofaman

sofaman
  • Members
  • PipPip
  • Member
  • 10 posts

Posted 23 October 2006 - 12:54 AM

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
I have 2 arms and 4 legs :D
www.clubvauxhall.net

#2 ToonMariner

ToonMariner
  • Members
  • PipPipPip
  • Advanced Member
  • 3,342 posts
  • LocationNewcastle upon Tyne, UK

Posted 23 October 2006 - 01:12 AM

you have to use upper case with those matey!!!

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

<?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" ;
?>

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....


follow me on twitter @PHPsycho

#3 sofaman

sofaman
  • Members
  • PipPip
  • Member
  • 10 posts

Posted 23 October 2006 - 05:32 AM

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
I have 2 arms and 4 legs :D
www.clubvauxhall.net




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users