Reply to Re: help with posting conditional if statement

Your name:

Reply:


Posted by Simon Stewart on 05/04/07 15:25

Art

Try something like this.

$holdchk= (strlen ($_POST['B1'])>0 and strlen($_POST['app_fname'])==0);
$action= ($holdchk)? "some.php": "other.php";
echo "<form method='POST' action='$action'>";

avoid isset and empty

S

"Art" <c_art@bellsouth.net> wrote in message
news:ryF_h.45454$254.26333@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;
> }
>
> if ($holdchk == 1 ){
> echo "<form method=\"POST\" action=\"some.php\">";
>
> }
>
> if ($holdchk == 0 ){
> echo "<form method=\"POST\" action=\"other.php\">";
>
> }
> }
> ?>
>
> <html>
>
> <head>
> </head>
>
> <form method="POST" action="">
>
> When
> hit the submit button</font></b> <input
> type="submit" value="Submit" name="B1"></p>
> </form>
> </body>
>
> </html>
>
>
>

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация