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 "<form method=$handling action=$loc>";
}
else
{
$handling = "POST";
$loc = "$SERVER[PHP_SELF]";
}
print "<form method='$handling' action='$loc'>";
?>
<input name="NAME" type="text" class="forms" value='<? echo $NAME;?>' >
<input name="PASS" type="password" class="forms" >
<input name="PASS-CONFIRM" type="password" class="forms" >
<input name="EMAIL" type="text" class="forms" value='<? echo $EMAIL;?>'>
<input name="sendForm" type="hidden" class="forms" value=0>
<?
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;
}
}
?>
</form>