Page is a not externally linkable
- Code, Content, and Presentation
-- PHP Server Side Scripting
---- PHP not remembering $ POST variables


pixeltierra - 5:09 pm on Sep 15, 2006 (gmt 0)


In plain english, the $_POST array is not sent back to the form page by using the back button (I wish it were that easy). I'll tell you a trick I use.

The default action for forms is the very same page that they are on. Submit the form to the form page and combine the form and form parsing code. It will look something like this:

if ($_POST) {
process data and show results...
if (errors in data) {
$prev_values = $_POST;
}
end script...
}

<form method="post">
<input name="thing" value=" <?php echo $prev_values['thing'];?>">

...
You use $prev_values to re-populate the form. If there was no $prev_values nothing is printed.

Good luck


Thread source:: http://www.webmasterworld.com/php/3084065.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com