memberlogin
contactus
randomfacts

How to generically loop through the form fieldnames

Using the array_keys function you can grab all of the variables passed in the url string. If the form submitted the fields used the post method instead then replace the HTTP_GET_VARS with HTTP_POST_VARS.

The function below will print the fieldname and value on their own line.

<?

$form_fields = array_keys($HTTP_GET_VARS);
for ($i = 0; $i < sizeof($form_fields); $i++) {

    $thisField = $form_fields[$i];
    $thisValue = $HTTP_GET_VARS[$thisField];
    echo $thisField ." = ". $thisValue;
    echo "<br />"; 

}

?>