$_POST is invisible!

software development

#1

Hi - I’ve got a DH hosted site for which all POST variables seem to have disappeared. I’ve written a test script to demonstrate this. Two forms - one submits using GET the other using POST. The GET one displays the variables and the to other doesn’t. Can anyone see anything in the test script which would cause this to happen ? I’d be grateful for any advice.

<?php error_reporting(E_ALL); ?> body { margin: 5%; background-color: silver; color: black; font-family: verdana; arial; sans-serif; font-size: 0.8em; }

A Form using POST

Press the button to see your form entries echoed to the screen in the 'POST Variables Dump'

A Form using GET

Press the button to see your form entries echoed to the screen in the 'GET Variables Dump'

<?php // ------------------------------------ print '

POST Variables Dump

'; print '$_POST array'; // ------------------------------------ print "
"; // ------------------------------------ foreach ( $_POST as $key => $value ) { print $key . " " . "=" . " " . $value; print "
"; } // ------------------------------------ print "
"; // ------------------------------------ print "
"; // ------------------------------------ print '

GET Variables Dump

'; print '$_GET array'; // ------------------------------------ print "
"; // ------------------------------------ foreach ( $_GET as $key => $value ) { print $key . " " . "=" . " " . $value; print "
"; } // ------------------------------------ print "
"; // ------------------------------------ print "
"; // ------------------------------------ print '$_REQUEST array'; // ------------------------------------ print "
"; // ------------------------------------ foreach ( $_REQUEST as $key => $value ) { print $key . " " . "=" . " " . $value; print "
"; } // ------------------------------------ // ------------------------------------ print "
"; // ------------------------------------ print "
"; // ------------------------------------ print '$_GLOBALS array'; // ------------------------------------ print "
"; // ------------------------------------ echo "
"; print_r($GLOBALS); echo "
"; ?> <?php print $_POST['$a1']; print $_POST['$b1']; print $_GET['$a2']; print $_GET['$b2']; ?>

#2

$SERVER[PHP_SELF]


#3

Actually, it should be:$_SERVER['PHP_SELF']si-blog
Max discount on any plan with promocode SCJESSEYTOTAL


#4

I am having the same problems too. All the _POST variables are blank. I had to pull down all my sites.

did they change the post_variable value?


#5

I did a test on $_POST. It is working properly.

$50 off and 3 free domains with code: [color=#CC0000]DH3[/color] Sign Up NOW or More Codes Here


#6

If the action attribute is left blank, HTML defaults it to the current file, so the method for accessing PHP_SELF is irrelevant. Besides, that was not the problem. The form was being submitted as expected, the data is/was not being returned as expected.

Edit: It’s not as irrelevant as I thought. After some testing, I have determined that, yes, you need to replace $PHP_SELF with $_SERVER[‘PHP_SELF’]. PHP5 has register_globals off which eliminates all shortcut server variables (aka Magic Globals or Super Globals).

Source: http://us3.php.net/manual/en/language.variables.predefined.php

Visit me, please…
www.theraven7.com


#7

I think you’ll find I already said that above.

si-blog
Max discount on any plan with promocode SCJESSEYTOTAL


#8

I know, but it can never be said enough. :slight_smile:

Visit me, please…
www.theraven7.com


#9

I got an email from DH tech support. It seems that someone screwed up the config on a bunch of machines which had the effect of removing the POST variables from all requests to those machines. It was fixed by the time I woke up.