passing form data using $_SESSION

From: Date: Mon, 20 Oct 2003 23:31:56 +0000
Subject: passing form data using $_SESSION
Groups: php.general 
Request: Send a blank email to php-general+get-166862@lists.php.net to get a copy of this message
Hiya. The way I do my forms is I create a form page and a corresponding processing page. I don't like to post forms to themself so I always make a processing page that header("Location: ...")'s back to the original page. Normally I create a long string that get's posted back to the original page via the querystring. For example: if(the name is blank) { $errors = "e_name=Name cannot be blank&"; } if(the company is blank) { $errors .= "e_comp=Company cannot be blank&"; } $location = "originalpage.php?$errors"; So then I redirect with the $location variable. But instead of passing it back through the querystring, what about assigning the values to the $_SESSION array and simply checking for the existence of those values on the original form? I think it will work fine (and even better than posting everything) but I'm wondering if there's something I'm not considering that makes this Not A Good Idea(tm)? Thanks, Chris. -- Don't like reformatting your Outlook replies? Now there's relief! http://home.in.tum.de/~jain/software/outlook-quotefix/

« previous php.general (#166862) next »