telling my form if method is POST or GET, which depends on a variable
Hi all,
does anyone know a way to tell a form’s method to be GET or POST which is up to a variable. the error output should start below all textfields.
i have a hidden field ‘$_REQUEST[‘sendForm’]’ which is’s default value is ‘0’.
when you hit the submit button (image submit button), all fields will be checked. if ererything’s ok, $_REQUEST[‘sendForm’]’ is set to ‘1’ and it should decides what action to take: GET or POST …
also tried the header(‘location…php’) stuff with a function at the beginning of the script. everytime i call my function from below (after checking my fields) it tells me that the headers already sent…
here is the code:
<?PHP if($_REQUEST['sendForm'] == 1) // decide grrr..grrr { $handling = "GET"; $loc = "d_submitResponse.php"; print ""; } else { $handling = "POST"; $loc = "$_SERVER[PHP_SELF]"; } print ""; ?> <? foreach($_REQUEST as $key => $value) { $countFields = count($_REQUEST); // how many textfields if(!empty($value)) { $setFields++; } if($countFields == $setFields && $_REQUEST['PASS'] == $_REQUEST['PASS-CONFIRM']) { $formOK = 1; } if(!empty($_REQUEST['PASS']) == !empty($_REQUEST['PASS-CONFIRM']) && !empty($_REQUEST) && $formOK == 1) { $_REQUEST['sendForm'] == 1; } } ?>