Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting "Undefined" errors

Status
Not open for further replies.

djhawthorn

Technical User
Mar 4, 2002
641
AU
I keep getting this in my Apache Server error log:

[Wed Jul 24 16:38:43 2002] [error] PHP Notice: Undefined variable: REQUEST_METHOD in c:\web\htdocs\meeting_booking_form.php on line 24

Line 24 is the "if" line in this:

<?
if ($REQUEST_METHOD != &quot;POST&quot;) {
?>
<form METHOD=&quot;POST&quot; ACTION=&quot;meeting_booking_form.php&quot;>

Whenever I try to submit the form, it just goes straight back to the HTML form - it doesn't process the data, and generates the Apache error above. Any help is appreciated.
 
If you're using a more recent version of PHP, doesn't it have to be:

Code:
  if ($_SERVER[&quot;REQUEST_METHOD&quot;] != &quot;POST&quot;) {

Plus I'm not sure how the recent change to the php.ini file may affect that. They decided to default the &quot;register_globals&quot; to OFF for security reasons. You may need to set that to on, but I should probably let the more expert people comment on that. --
Jon
 
If you are starting to use PHP, the best way is realy let that in the off status. If you already used PHP before, and you used to use $varname as the name of a var passed to that page by a get or post method, you should change it to on, cause otherwise all your programs will fail.

But, besides that, there's another thing. Error_reporting. By default it cames with E_ALL. But, when you refer to a var not set before, it will provide you a notice. To prevent that, if you already have php code working, you should put in error_reporting= E_ALL && ~E_NOTICE
Anikin
Hugo Alexandre Dias
Web-Programmer
anikin_jedi@hotmail.com
 
Thanks, register_globals was off.

I knew it'd be something to do with the recent vuln's, but I didn't know where to look. I appreciate the help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top