Re: re: $POST vars
| From: | Nicole Amashta | Date: | Wed, 24 Apr 2002 15:48:53 +0000 |
| Subject: | Re: re: $POST vars | ||
| References: | 1 2 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-13277@lists.php.net to get a copy of this message | ||
You can set a hidden variable in your form that will be passed to the script
when it is posted. Then, you can check for that variable like so:
<input type="hidden" name="submitted" value="true">
<?
if ( $HTTP_POST_VARS["submitted"] == "true" )
{
# do something
}
else {
# this form has not been submitted yet.
}
?>
If you want to limit what scripts can post to the handling script, check the
referering script to make sure it is allowed, like so:
<?
#allowedscript.php is the script that is allowed to post to the handling
script, in this case.
if ( $HTTP_POST_VARS["submitted"] == "true" &&
eregi("allowedscript.php",
$HTTP_REFERER) )
{
# do something
}
else {
# this form has not been submitted yet.
}
?>
Just some ideas .... and there are multiple ways of doing this as well.
good luck with it,
--
Nicole Amashta
Web Application Developer
www.aeontrek.com
"Matt Babineau" <matt@criticalcode.com> wrote in message
news:009501c1eb9f$416ffbf0$0100a8c0@developerx...
> Yeah that is the idea, are there any bad things about doing it this way?
> The POST array does not exist if the page has not been posted to?
>
> Matt Babineau
> Freelance Internet Developer
> e: mbabineau@illuminatistudios.com
> p: 603.943.4237
> w: http://www.illuminatistudios.com
>
>
>
> -----Original Message-----
> From: Eduards Cauna [mailto:cauna@parks.lv]
> Sent: Wednesday, April 24, 2002 10:42 AM
> To: php-windows@lists.php.net
> Subject: RE: [PHP-WIN] re: $POST vars
>
>
>
> >I am merely trying to see whether a page was posted to or not, and
> >perform an action from the result.
> >
> >Matt Babineau
>
> <?
>
> if (@$HTTP_POST_VARS) {
>
> }
>
> ?>
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>