NYCPHP Meetup

NYPHP.org

[nycphp-talk] handling forms (relative newbie)

Adam Maccabee Trachtenberg adam at trachtenberg.com
Tue Sep 30 15:52:36 EDT 2003


On Tue, 30 Sep 2003, Aaron Fischer wrote:

> Basically, I am using php to enforce required fields on a form, load
> a page that allows the user to confirm information is accurate (if
> not, reload the form page), and finally once all is OK, process the
> variables by inserting the data into mysql, sending an email
> confirmation to the user and loading a confirmation page.

> Possible solutions:
> 	Perform manual POST using PHP
> 	Use PEAR's http request class
> 	Use cURL
> 	Store $_POST as a session variable
> 	Use http.inc class
> 
> Thanks for any suggestions,

I advocate storing $_POST as a session variable. (Or the specific POST
variables you want to keep.)

You stuff the POSTed data into a temporary session and then retrieve
it out of $_SESSION in the confirmation page and MySQL insertion
page. Once it's done, session_destroy() it.

Saves you all the hassle of, well, most of the above. If you're against
cookies, there's always the URL rewriting feature of Session, which
should be easy to ensure given the nature of your transaction.

I'm all for using the simplest solution possible, unless you can't.

-adam

-- 
adam at trachtenberg.com
author of o'reilly's php cookbook
avoid the holiday rush, buy your copy today!




More information about the talk mailing list