On Thursday, April 11, 2002, at 04:09  PM, Erik Price wrote:

> I'm trying to think of a clever way to send both POST and GET data in 
> the same form.  I want to use GET data so that the variables appear in 
> the querystring (so that users can bookmark or save the URL, it's a 
> search engine-kinda thing), but I have a main switch() statement which 
> is controlled by POST data -- because after the search engine step of 
> the form, I want the rest of the data to be sent by POST.
> Any good ideas?

I just thought of an answer to my own question -- I could change the 
switch() statement so that it is controlled by GET data and simply pass 
the appropriate value on the querystring in the form's "action" 
attribute, but use POST as the method of the form.  So I end up with a 
form that looks like:

$form = "<form method=\"post\" action=\"" . $_SERVER['PHP_SELF'] . 

This works very well -- and by including a hidden form field in the 
POST-based form like "<input type="hidden" name="fromform" 
value="yes" />", I can perform a test at the receiving end to make sure 
that the user didn't bookmark this page.  Of course, it's not real 
security, since anyone could fake the POST data, but I'm not trying to 
hide anything -- just trying to keep the user from making a dumb mistake.



Erik Price
Web Developer Temp
Media Lab, H.H. Brown

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to