Advertisement
Guest User

Untitled

a guest
Aug 8th, 2013
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.61 KB | None | 0 0
  1. <?php session_start(); ?>
  2.     <?php
  3.     //check if the user is logged in
  4.     if (isset($_SESSION['validuser'])) {
  5.       echo 'valid user ';
  6.           //catch this first - before user spends time filling out the 12 fields!
  7.           //send to message page saying "you cannot register - you are already a member and     logged in"
  8.           //WORKING PERFECTLY - CONFIRMS FORM POSTING TO SAME PAGE CORRECTLY!
  9.           //time for other checks....
  10.     }
  11.     elseif (!isset($_SESSION['validuser']) && isset($_POST['submit'])) {
  12.       echo 'invalid user ';
  13.           //if there is no logged in user and form has been submitted, start checking the      fields to see if any fields are empty
  14.           //collect all errors in array and display?
  15.           //direct back to the form with appropriate messages, form fields retained
  16.           //exit here? or no?
  17.           //focus  now has to pass to the form again - need any code for this? or will it happen automatically?
  18.     }
  19.     if (isset($_POST['submit'])) {
  20.       echo 'posted';
  21.           //Should this part be within the else block?
  22.           //If it is out side, will it get rendered on load?
  23.           //if there are no errors proceed to process the form
  24.           //there are further checks that need talking to the database
  25.           //once those checks and approvals are over the data gets saved to the database
  26.  
  27.     }
  28.  
  29.  
  30.     ?>
  31.     <html>
  32.        <body>
  33.         <form action="?" method = "POST">
  34.             <!--  12 fields to be filled out by user     -->
  35.             <input type = "submit" name = "submit" value = "submit" />
  36.         </form>
  37.         </body>
  38.     </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement