Entry
What is the best way to send an 'unknown' number of form fields and access them on the text page?
Feb 28th, 2008 00:02
dman, Jeroen Keppens, John McCaskill, http://www.ttnr.org
<?
// First reset the array storing all values recieved from the form
reset ($HTTP_POST_VARS); // if form method="post"
reset ($HTTP_GET_VARS); // if form method="get"
// First way : with "while loop"
while (list($key, $value) = each ($HTTP_POST_VARS)) {
echo "Key: $key; Value: $value<br>\n";
}
// Second way : with "foreach"
foreach ($HTTP_POST_VARS as $key => $value) {
echo "Key: $key; Value: $value<br>\n";
}
?>
I hope this answers your question
Jeroen