|
Posted by Rami Elomaa on 05/05/07 08:49
Geoff Berrow kirjoitti:
> Message-ID: <DXN_h.24026$XU4.14377@bignews8.bellsouth.net> from Art
> contained the following:
>
>> Geoff, I tried modifying the code with your suggestions. It had the effect
>> of disabling the submit button. It seems like there has to be <form
>> method="POST" action=""> in the html, to enable the submit button.
>> Variables aren't being recognized by the html as defining the form.
>
> I was in a hurry last night because I was going out and not really
> paying attention. Your code /is/ still seriously screwed but that
> wasn't the solution.
>
> Can you please describe what you /expect/ it to do? I'm sure the answer
> is very simple.
>
Your sample was missing the default form. It only worked in the case
when something was posted, but in the case the page is opened the first
time, there is no form tag at all...
So, once again, from the top...
<?php
$holdchk = 0;
if (isset($_POST['B1'])) { // if the form was submitted
$form= "<br><br><br>";
if (empty($_POST['app_fname'])) {
$holdchk = 1;
}
if ($holdchk === 1 ){
$form.= "<form method='POST' action='some.php'>";
}
if ($holdchk === 0 ){
$form.= "<form method='POST' action='other.php'>";
}
} else { // no form was submitted
$form = "<form method='POST' action='{$_SERVER['PHP_SELF']}'>";
}
?>
<html>
<head>
</head>
<?php echo $form;?>
When
hit the submit button</font></b> <input
type="submit" value="Submit" name="B1"></p>
</form>
</body>
</html>
I think this is what Geoff meant, he just forgot the default case. :)
--
Rami.Elomaa@gmail.com
"Wikipedia on vähän niinq internetin raamattu, kukaan ei pohjimmiltaan
usko siihen ja kukaan ei tiedä mikä pitää paikkansa." -- z00ze
[Back to original message]
|