Re: How to test
| From: | Justin French | Date: | Thu, 08 Aug 2002 10:25:57 +0000 |
| Subject: | Re: How to test | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-111622@lists.php.net to get a copy of this message | ||
If you're using PHP >= 4.1.1, pull the vars straight out of the POST super
global array.
<form action="foo.php" method="post">
<input type="text" name="foo">
</form>
<?
//foo.php
echo $_POST['foo'];
?>
There's also GET, COOKIE, SESSION, ENV, and a few more -- have a read here:
http://www.php.net/manual/en/language.variables.predefined.php
Justin French
on 08/08/02 7:31 PM, Bas Jobsen (bas@startpunt.cc) wrote:
> Hello,
>
> How can i test if a post request realy came from the right form?
> Now i have:
>
>
> if(!strstr($HTTP_SERVER_VARS['HTTP_REFERER'],$HTTP_SERVER_VARS['SERVER_NAME'])
> || $HTTP_SERVER_VARS['REQUEST_METHOD']!='POST')exit;
>
> But this goes wrong soon as HTTP_REFERER isn't set.
>
> Thanks,
>
> Bas