$_POST is invisible !!
Posted by: southof40
Posted on: 2008-02-07 01:07:00
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);
?>
<html>
<style>
body {
margin: 5%;
background-color: silver;
color: black;
font-family: verdana; arial; sans-serif;
font-size: 0.8em;
}
</style>
<body>
<h2> A Form using POST</h2>
<p>Press the button to see your form entries echoed to the screen in the 'POST Variables Dump'</p>
<form id="Form1" name="Form1" method="POST" action="<?php print $PHP_SELF; ?>">
<input type="checkbox" value="1" name="a1">
<input type="checkbox" value="1" name="b1">
<input type="submit" name="Answer" value="Submit this form using POST">
</form>
<h2> A Form using GET</h2>
<p>Press the button to see your form entries echoed to the screen in the 'GET Variables Dump'</p>
<form id="Form2" name="Form2" method="GET" action="<?php print $PHP_SELF; ?>">
<input type="checkbox" value="1" name="a2">
<input type="checkbox" value="1" name="b2">
<input type="submit" name="Answer" value="Submit this form using GET">
</form>
<?php
// ------------------------------------
print '<h2>POST Variables Dump</h2>';
print '$_POST array';
// ------------------------------------
print "<BR/>";
// ------------------------------------
foreach ( $_POST as $key => $value ) {
print $key . " " . "=" . " " . $value;
print "<BR/>";
}
// ------------------------------------
print "<BR/>";
// ------------------------------------
print "<BR/>";
// ------------------------------------
print '<h2>GET Variables Dump</h2>';
print '$_GET array';
// ------------------------------------
print "<BR/>";
// ------------------------------------
foreach ( $_GET as $key => $value ) {
print $key . " " . "=" . " " . $value;
print "<BR/>";
}
// ------------------------------------
print "<BR/>";
// ------------------------------------
print "<BR/>";
// ------------------------------------
print '$_REQUEST array';
// ------------------------------------
print "<BR/>";
// ------------------------------------
foreach ( $_REQUEST as $key => $value ) {
print $key . " " . "=" . " " . $value;
print "<BR/>";
}
// ------------------------------------
// ------------------------------------
print "<BR/>";
// ------------------------------------
print "<BR/>";
// ------------------------------------
print '$_GLOBALS array';
// ------------------------------------
print "<BR/>";
// ------------------------------------
echo "<pre>"; print_r($GLOBALS); echo "</pre>";
?>
<?php
print $_POST['$a1'];
print $_POST['$b1'];
print $_GET['$a2'];
print $_GET['$b2'];
?>
</body>
</html>