Jump to content

undefined variable _post and _server


sofaman

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
Link to comment
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....

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.