Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php session_start(); ?>
- <?php
- //check if the user is logged in
- if (isset($_SESSION['validuser'])) {
- echo 'valid user ';
- //catch this first - before user spends time filling out the 12 fields!
- //send to message page saying "you cannot register - you are already a member and logged in"
- //WORKING PERFECTLY - CONFIRMS FORM POSTING TO SAME PAGE CORRECTLY!
- //time for other checks....
- }
- elseif (!isset($_SESSION['validuser']) && isset($_POST['submit'])) {
- echo 'invalid user ';
- //if there is no logged in user and form has been submitted, start checking the fields to see if any fields are empty
- //collect all errors in array and display?
- //direct back to the form with appropriate messages, form fields retained
- //exit here? or no?
- //focus now has to pass to the form again - need any code for this? or will it happen automatically?
- }
- if (isset($_POST['submit'])) {
- echo 'posted';
- //Should this part be within the else block?
- //If it is out side, will it get rendered on load?
- //if there are no errors proceed to process the form
- //there are further checks that need talking to the database
- //once those checks and approvals are over the data gets saved to the database
- }
- ?>
- <html>
- <body>
- <form action="?" method = "POST">
- <!-- 12 fields to be filled out by user -->
- <input type = "submit" name = "submit" value = "submit" />
- </form>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement