|
Posted by Vince Morgan on 05/04/07 12:51
"Vince Morgan" <vinharAtHereoptusnet.com.au> wrote in message
news:463b2886$0$10157$afc38c87@news.optusnet.com.au...
>
> "Art" <c_art@bellsouth.net> wrote in message
> news:QxF_h.45453$254.40238@bignews7.bellsouth.net...
> > Can anyone help. I've tried scaling down a script to the bare minimum
and
> > it still is not working correctly. What I think should happen is that
> when
> > the field app_fname is blank, that $hold_chk will get set to 1 and the
1st
> > if statement will be executed. What actually happens is that when I hit
> > submit, the form stays where it is, for example if the form where the
> submit
> > button is located is on the form other.php, then when I hit submit this
is
> > where it stays. If I then hit the submit button a 2nd time, it post to
> the
> > some.php form. I've tried this script without the conditional
if(isset()
> > and it works. I need to have the isset() otherwise the form displays
all
> > empty fields as soon as it loads, before the submit button is hit. Any
> help
> > would be appreciated. After working on this for 2 weeks it seems like
i'm
> > stuck.
> >
> > Thanks
> > Art
> >
> > <?php
> >
> > $holdchk = 0;
> >
> > if (isset($_POST['B1'])) {
> >
> > echo "<br><br><br>";
> > if (empty($_POST['app_fname'])) {
> > $holdchk = 1;
> > }
> >
>
> You don't realy need $holdchk as I see it. You can set the form name
> instead.
>
First time through I've realized $form will be unset and there is not
default form, and as your first if statement doesn't offer an else that will
always be the case.
You need a form name to post to on the first run, and I would suggest in
this case posting back to itself for the sake of the exercise. You haven't
included the code that detirmines why "some.php" in one case and "other.php"
in an other, though I'm sure you know the reasons.
Perhaps you should set the $form var to the name of the first form you need
to call when $_POST['B1'])) is *not* set.
Or, just call the form itself as below on the first post.
Ie;
<?php
$form = $_SERVER['PHP_SELF'];
if (isset($_POST['B1'])) {
echo "<br><br><br>";
if (empty($_POST['app_fname'])) {
$form='some.php';
}else{
$form='other.php';
}
}
?>
<html>
etc.
HTH
Vince
[Back to original message]
|