For Programmers: Free Programming Magazines  


Home > Archive > PHP Language > May 2007 > help with posting a form using if conditional









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author help with posting a form using if conditional
Art

2007-05-03, 9:57 pm

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 ws 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>


Xxemoxbitchxx7878

2007-05-08, 9:39 pm

http://Angelina-Jolie-doing-it.info...hp?movie=148803
Raymundo

2007-05-14, 1:58 am

http://Angelina-Jolie-doing-it.info...p?movie=1673286
ashore

2007-05-17, 3:59 am

Hint: When the page is on screen, VIEW SOURCE, and see if it's what
you expect it to be.

-AS

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com