NYCPHP Meetup

NYPHP.org

[nycphp-talk] handling forms (relative newbie)

Scott Mattocks crisscott at netzero.com
Thu Oct 2 15:47:19 EDT 2003


> $_SESSION = $_POST;

You just killed anything else you had in the session with that line. You 
probably don't want to overwrite your entire session array.  Use 
something like was suggested before:
$_SESSION['_POST'] = $_POST;
This will still let you access other info that was in your session.
Scott Mattocks


> -----Original Message-----
> From: talk-bounces at lists.nyphp.org [mailto:talk-bounces at lists.nyphp.org]
> On Behalf Of Aaron Fischer
> Sent: Thursday, October 02, 2003 2:13 PM
> To: NYPHP Talk
> Subject: Re: [nycphp-talk] handling forms (relative newbie)
> 
> 
> After some fumbling and stumbling I seem to have things working OK.  
> However, right now I am naming each form element/post variable 
> individually to put the data into session_register, which could be a 
> pain the longer the form gets!  I would like to, as Adam put it, "stuff 
> the POSTed data" into $_SESSION using $_POST but I don't see how to do 
> this.
> 
> Example my code:
> session_start();
> session_register('first_name','last_name',etc.,etc.many more fields to 
> follow...);
> header ("Location: session_results.php");
> exit;
> 
> Session Results page:
> session_start();
> echo "$_SESSION[first_name]";
> 
> Whenever I start trying to use session_register with _POST things go 
> south quick.
> 
> Hints/suggestions?
> 
> TIA,
> 
> -Aaron
> 
> On Tuesday, September 30, 2003, at 04:23 pm, Adam Maccabee Trachtenberg 
> wrote:
> 
> 
>>My advice is to try it with cookies first because it might be easier
>>to test. (On your machine, you don't need to worry about rejecting
>>cookies.)
>>
>>Once that's working, add in the URL rewriting. This might not be
>>necessary, but when dealing with something new, I don't like to jump
>>in head first, as it makes it really difficult to debug.
>>
>>-adam
> 
> 
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk
> 
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk
> 
> 




More information about the talk mailing list