$_POST array clears out
Hello,
I'm trying to make a registration form formed of four steps using the
same file. At each step I process the $_POST vars, I colect some more
and move to the next step. The problem I have is that after second
step the $_POST varialble (array) clears out. I know that because I
print_r($_POST) array.
What am I doing wrong?
Thanks,
-D
Re: $_POST array clears out
dacoman [at] gmail.com <dacoman [at] gmail.com> wrote:
> Hello,
>
> I'm trying to make a registration form formed of four steps using the
> same file. At each step I process the $_POST vars, I colect some more
> and move to the next step. The problem I have is that after second
> step the $_POST varialble (array) clears out. I know that because I
> print_r($_POST) array.
>
> What am I doing wrong?
The $_POST array is created as a new array and populated with the current
posted variables on each page-request. If the variables you're checking
are not in the second form the user posts, they will not be available to
you.
To bypass this, you can either:
1. Start a session and save them in the $_SESSION array.
2. Make hidden postfields in the subsequent forms containing the previous
input. This would mean you have to revalidate them over and over again
though.
--
Rik Wasmus
Re: $_POST array clears out
On Feb 7, 1:39 pm, "daco... [at] gmail.com" <daco... [at] gmail.com> wrote:
> Hello,
>
> I'm trying to make a registration form formed of four steps using the
> same file. At each step I process the $_POST vars, I colect some more
> and move to the next step. The problem I have is that after second
> step the $_POST varialble (array) clears out. I know that because I
> print_r($_POST) array.
>
> What am I doing wrong?
>
> Thanks,
> -D
You can also save the values using a for each statement into a single
array and then pass that as a session variable, a get or a hidden
field which makes the process more manageable. Each round you can add
more data to the array using the form input names as keys. You can
then retrieve your data with a for each loop or key by key and put it
where you want it.
--Kenoli