POSTing data back to the same script
Posted: Thu Mar 16, 2006 9:00 am
Hello,
If I have a script script.php, which reads POST data at the beginning of the script and changes page according to the contents of the POST data, can a page with a FORM POST data back to the same script?
e.g.
I've tried the equivalent of this in CGI and I appear to be getting an HTTP 502 error (gateway).
Many thanks
Mark
If I have a script script.php, which reads POST data at the beginning of the script and changes page according to the contents of the POST data, can a page with a FORM POST data back to the same script?
e.g.
Code: Select all
script.php:
if( $_POST['data'] == 'page' )
{
echo '
<form action="script.php" method="post">
<input type="hidden" name="page" value="data">
<input type="submit" name="submit" value="Submit To Same Script >>"/>
</form>';
}
else
{
?>
This is another bit of code.
<?php
}Many thanks
Mark