faqts : Computers : Programming : Languages : PHP : Common Problems : Forms and User Input

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

37 of 51 people (73%) answered Yes
Recently 7 of 10 people (70%) answered Yes


If I altered the values (of a form submission) after a POST how do i display them back in the form?

May 11th, 2002 16:33
Philip Olson, Esben Maaløe, Erik Johansson, Nathan Wallace, Rowel Cox, http://www.php.net/FAQ.php#7.1 http://www.faqts.com/knowledge-base/view.phtml/aid/640/fid/91/lang/

Assuming your form is method="POST" then we can simply do:
It'll show exactly what names/values have been posted.  If you're unsure
of the form method, $_REQUEST will work too (introducted PHP 4.1.0), so:
If you simple want to cycle through the variables, consider a while loop
or a foreach statement:
if (count($HTTP_POST_VARS) > 0) {
  foreach ($HTTP_POST_VARS as $key => $value) {
    print "$key => $value <br />\n";
Read more about predefined variables here: