boards.ie

Go Back   boards.ie > Tech > Software and Web Development > Development

Notices

Reply
 
Thread Tools Search this Thread Display Modes
Old 01-09-2009, 07:42   #1
corblimey
Registered User
 
corblimey's Avatar
 
Join Date: Nov 2004
Posts: 2,161
[PHP] $_POST was empty due to syntax error

So last night I thought I'd install PHP5.2 on my WAMP server at home. Big mistake. 4 hours later I've wiped my server and reinstalled from WAMPServer2.0. Everything appears to be ok except my main login form wouldn't post or get data:
Code:
<?php
error_reporting(E_ALL);

echo "<pre>";
$data = file_get_contents('php://input');
var_dump($data);
print_r($_REQUEST);
print_r($_POST);
print_r( $GLOBALS );
print_r( $HTTP_GET_VARS );
print_r( $HTTP_POST_VARS );
echo "</pre>";
?>
When I ran this and posted the form I'd get:
Quote:
string(0) ""
Array()
Array()
Array
(
[GLOBALS] => Array
*RECURSION*
[_POST] => Array
(
)

[_GET] => Array
(
)

[_COOKIE] => Array
(
[logged_in] => 1
[PHPSESSID] => lrl9o34cc5p3u3fmd1dl502s51
)

[_FILES] => Array
(
)

[_REQUEST] => Array
(
)

[error] =>
[lemail] =>
[lpass] =>
[lrem] => 0
[data] =>
)

Notice: Undefined variable: HTTP_GET_VARS in C:\wamp\www\eazine\ver2\login.php on line 15

Notice: Undefined variable: HTTP_POST_VARS in C:\wamp\www\eazine\ver2\login.php on line 16
Reducing the form and checking all syntax, I found that the form itself was in a showform() function which took in 2 parameters, but on the initial call, I only had one, showform(""). Changing it to showform("", "") resolved the issue.

Any reason why a) the form would still show and error_reporting wouldn't catch it? b) the resulting post would be empty? It had me googling for about a hour and a half before I figured it out.
__________________
I know it sounds like I'm in denial, but I'm not.
corblimey is offline   Reply With Quote
Advertisement

To remove these adverts, please create an account, or log in! You must have an account to post anyway :-)
Old 01-09-2009, 07:49   #2
corblimey
Registered User
 
corblimey's Avatar
 
Join Date: Nov 2004
Posts: 2,161
I tell a lie, I still have this problem. I was able to get in once, but not anymore. $_POST is constantly empty.
__________________
I know it sounds like I'm in denial, but I'm not.
corblimey is offline   Reply With Quote
Old 01-09-2009, 08:31   #3
daymobrew
Moderator
 
Join Date: Jul 2004
Location: Dublin 15
Posts: 3,747
Mod: Cycling
Post the form html code.
__________________
Triathlon calendar; Website Development in Dublin 15;
BusSched/TrainSched for Palm OS/Pocket PC/Windows
daymobrew is offline   Reply With Quote
Old 01-09-2009, 16:35   #4
corblimey
Registered User
 
corblimey's Avatar
 
Join Date: Nov 2004
Posts: 2,161
Quote:
Originally Posted by daymobrew View Post
Post the form html code.
After a few more attempts, I took the form html code out of the function I had it in, and it seems to be work fine now. Not sure why that works, but why it worked pre-PHP5.2 or WAMPServer2.0. If forms won't work in functions, I'm in a lot of trouble

ETA: Ignore all my rambling above. It turned out that it was posting but on the next page I redirect back to login if a login cookie isn't set. However I was using HTTP_COOKIE_VARS instead of _COOKIE and this was always unset, so it would always redirect back to the login page with an empty _REQUEST. Simple.
__________________
I know it sounds like I'm in denial, but I'm not.

Last edited by corblimey; 01-09-2009 at 16:51.
corblimey is offline   Reply With Quote
Reply
  boards.ie > Tech > Software and Web Development > Development Top

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT. The time now is 02:13.


© boards.ie Ltd. (Ireland) - Hosted by Digiweb Hosting. Message Boards and Forums Directory