[thelist] Feedback form [PHP]

Nedret Saidova saidovan at rs.uovs.ac.za
Fri Jan 17 08:48:00 CST 2003


I'm trying to save the fields submitted by the user from a feedback form so that if the
data is not validated as required, they go back to the form without having lost their
previous typing. I do that by saviing all in hidden fields in a form that I post back
after notifying them what is wrong.

I use the following code:

if (!filled_out($_POST))
{
	echo 'Error: Form not filled out!<br>';
	echo 'Please go back and complete all fields';

	echo "<form action = 'E_contact.php' method = 'post'>";
	foreach($_POST as $key => $value) echo "<input type = 'hidden' name =
".$key." value = ".$value.">\n";
	echo "<input type = 'hidden' name = 'action' value = 'back' >\n";
	echo "<input type= 'submit' value = 'Go back'>";
	echo "</form>";

	exit;
}

but only the first words in any field get saved and carried back.

Any thoughts on why this might be? Maybe there is a shorter way to accomplish
my goal. (I am aware of the JavaScript powers in this regard - was just curious how I
can do it with PHP.)

Thank you

Nedret



More information about the thelist mailing list