Why does the following code not work:
As far as I am aware the name of the submit buttons is what I should be testing for to see if the form has been submitted. I also tried the code from php.net which looks likeCode:<?php print_r($_POST); if( isset($_POST['logon']) or isset($_POST['register']) ) { echo "Do I get here"; if( isset($_POST['fname']) ) { echo 'Register'; } else { echo 'log on'; } } else { ?> <fieldset> <legend>Log On</legend> <form action="<?=INDEX . "?" . LOG_ON; ?>" method="post" enctype="text/plain"> <p>If you have already registered enter your log on details.</p> <ul> <li><label for="user">User Name:</label><input type="text" name="user" /></li> <li><label for="pwd">Password:</label><input type="password" name="pwd" /></li> <div class="ralign"><button type="submit" name="logon">Log On</button></div> </ul> </form> </fieldset> <p/> <fieldset> <legend>Register</legend> <form action="<?=INDEX . "?" . LOG_ON; ?>" method="post" enctype="text/plain"> <p>If you are not registered you need to enter you details below. All fields are required</p> <ul><li><label for="fname">Forename:</label><input type="text" name="fname" /></li> <li><label for="sname">Surname:</label><input type="text" name="sname" /></li> <li><label for="user">User Name:</label><input type="text" name="user" /></li> <li><label for="pwd">Password:</label><input type="password" name="pwd" /></li> <li><label for="email">E-mail:</label><input type="text" name="email" /></li> <div class="ralign"><button type="submit" name="register">Register</button></div></ul> </form> </fieldset> <?php } ?>Basically I am never passing the first condition. Can anyone tell me why? The print_r function always prints Array() which, I think, means nothing is getting set.Code:(isset($_POST['action']) && $_POST['action'] == 'submitted')







Bookmarks