sofaman Posted October 23, 2006 Share Posted October 23, 2006 I'm new to php, I'm learning from a book at the minute.I'm running:apache web server 2.0.59PHP 5.0.2Mysql 5.0.24 (as a module not cgi)The same versions as what the book uses.I've installed a forum - no problemsI've created a database useing the cmd lineI can view the database in IEWhen 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 _postso I tried :<? $browser = $_server['php_shelf'];echo "the sniffer says: $browser" ;?>I get undefined variable _serverI've search here and php.net, I've looked through php.ini but not found anything I think might workPlease helpcheerssofa Link to comment https://forums.phpfreaks.com/topic/24792-undefined-variable-_post-and-_server/ Share on other sites More sharing options...
ToonMariner Posted October 23, 2006 Share Posted October 23, 2006 you have to use upper case with those matey!!!and PHP_SELF (not php_shelf) not seen shelf anywhere ;)try this..[code]<?phpif ($_POST) { // create empty error variable $msg = "";I receive undefined variable _postso 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 https://forums.phpfreaks.com/topic/24792-undefined-variable-_post-and-_server/#findComment-112919 Share on other sites More sharing options...
sofaman Posted October 23, 2006 Author Share Posted October 23, 2006 Thank you so much they work a treat :DI'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 Link to comment https://forums.phpfreaks.com/topic/24792-undefined-variable-_post-and-_server/#findComment-112992 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.