I start with three buttons value 'red', 'green' and blue (select.php). This information is then sent via $_POST to a new file 'process.php' This information is stored in a variable $colour = $_POST ['colour'], no problem. This is then processed in a MySQL query and display all objects that are either 'red', 'green' or 'blue'.
Next I place two check boxes that I need to record checked or unchecked, I'm also using $_POST, form action = 'process.php'. again no problem.
However when this redirects back to 'process.php', the program is now looking for name = 'colour' from within the $_POST array coming from the checkboxes, obviously not finding it, it now cannot use this variable .
I'm sure there is a vary easy way to keep my $colour variable but I can't figure it out. Be patient I've only been studying PHP for a month or so.
Disappearing $_POST Variables
Moderator: General Moderators
-
Mark Baker
- Forum Regular
- Posts: 710
- Joined: Thu Oct 30, 2008 6:24 pm
Re: Disappearing $_POST Variables
Either embed it in your second form as a hidden field, or store it in session
Re: Disappearing $_POST Variables
Thanks, I thought of using a hidden field, but probable should start learning how to use $_SESSION.