9
We have three PHP pages with html form. In the first page we have the fields showing the values of the variables and the fields Hidden containing the values of the variables like this:
<input name="nome" type="hidden" value=".$nome." >
From the first page to the second, all values are passed correctly via $_POST['nome']
that way, because I checked with echo var_dump($nome)
.
From the second page to the third page which is the processing of the completed form whose values of the Hidden fields go to the database, the values of these variables are lost.
The var_dump()
shows that the variables were null (NULL
) and I also get the message:
Indefined index [...]
Note that variables that only exist on the second page are normally inserted in the bank.
If I pass directly without field hidden
, goes to the database the value .$nome.
What could I be doing wrong? How else could I advance these variables to the third page?
Look friend this practice that you are using to return the variables to the frontend and re-assimilate to the next pages is very insecure and flawed as you said yourself. I recommend you work with
$_SESSION
PHP, can read more here, store only once your variable in the session and you don’t need to put it in hidden fields for the next.– Gabriel Gartz
Uhmm... So is there such a flaw? Isn’t it necessarily my mistake? Okay, thank you!
– Vinicius
No @Vinicius, what he meant is that the way he’s doing it is susceptible to crashes, not necessarily a PHP bug or glitch. It was probably your mistake at some point.
– Daniel Omine
Note:
var_dump()
does not need toecho
before him– gmsantos