I am trying to insert a value the POST array of some value that is not used anywhere (not a hidden value, button, etc.) The use is for sequential page step process. I use a hidden field for the current page, which is then incremented. I need to keep track of the previous page using POST. I do something like:
$_POST[prev] = $_POST[current];
The previous is fine until I switch to the next page, and is then removed from POST.
I tried having two hidden variables, but the next page would never be displayed...
Ideas?
Injecting Value into POST w/o an actual value
Moderator: General Moderators
- superdezign
- DevNet Master
- Posts: 4135
- Joined: Sat Jan 20, 2007 11:06 pm
- CoderGoblin
- DevNet Resident
- Posts: 1425
- Joined: Tue Mar 16, 2004 10:03 am
- Location: Aachen, Germany
Normally you pass this sort of information from the form as a hidden form field if you are using a form and submit buttons rather than links for Next and Previous.
In general though I tend to have any "buttons" for Next/Previous as links with a $_GET variable passed
OK the would probably be dependant on design maybr CSS left and right but you get the picture I hope. I find this method to be a lot cleaner than using forms. Also you do not not into problems with multiple forms when designing a "wizard". It's also cleaner for users who use some browsers which ask about $_POST values etc when using the browser back button rather than your links.
If you want to solve the problem you actually have using $_POST values can you post some code?
In general though I tend to have any "buttons" for Next/Previous as links with a $_GET variable passed
Code: Select all
<a href="http://your_url.html?page=1">⇐Previous</a>
Currently on Page 2 of 10
<a href="http://your_url.html?page=3">Next⇒</a>If you want to solve the problem you actually have using $_POST values can you post some code?