Results 1 to 6 of 6

Thread: [RESOLVED] Page Issue !!!

  1. #1

    Thread Starter
    Fanatic Member aNubies's Avatar
    Join Date
    Aug 2008
    Posts
    558

    Resolved [RESOLVED] Page Issue !!!

    Guys, since i am starting to learn php. I have this issue wherein, when it comes in validation how im going to control the page where the user make take place. I mean when you put a action in a <form> tag, when you click a button with it whether the inputed data is correct or not it will proceed to the specify page. But i want that if the user input a wrong data the page will retain, however, if the data is correct the page that i will specify will be loaded.

    Like this "Admin Login"

    if inputed a wrong data the login page will retain and it will display a message but if the data is correct it will go in the other page. I already manage the validation but the page that will be loaded is a problem. So How to do it.

  2. #2
    Super Moderator manavo11's Avatar
    Join Date
    Nov 2002
    Location
    Around the corner from si_the_geek
    Posts
    7,171

    Re: Page Issue !!!

    The easiest method would be to send the form to a page that will handle the data verification. Then, depending on the results, you can redirect to the page you want. So:

    login.php sends data to login_handle.php
    login_handle.php validates the data
    -correct login, set the session variable, redirect to admin.php
    -incorrect login, don't set the session variable, redirect to login.php?error=true (with error=true so you can show an error in the login page to indicate that it failed)


    Has someone helped you? Then you can Rate their helpful post.

  3. #3

    Thread Starter
    Fanatic Member aNubies's Avatar
    Join Date
    Aug 2008
    Posts
    558

    Re: Page Issue !!!

    Very silly hah thanks

    by the way how to do it ? redirecting

  4. #4
    Super Moderator manavo11's Avatar
    Join Date
    Nov 2002
    Location
    Around the corner from si_the_geek
    Posts
    7,171

    Re: [RESOLVED] Page Issue !!!

    Redirection:

    PHP Code:
    <?php
    header
    ("Location: page.php");
    ?>
    Make sure you haven't outputted any data though before you run this code (no HTML sent).


    Has someone helped you? Then you can Rate their helpful post.

  5. #5

    Thread Starter
    Fanatic Member aNubies's Avatar
    Join Date
    Aug 2008
    Posts
    558

    Re: [RESOLVED] Page Issue !!!

    thanks again

  6. #6
    Super Moderator manavo11's Avatar
    Join Date
    Nov 2002
    Location
    Around the corner from si_the_geek
    Posts
    7,171

    Re: [RESOLVED] Page Issue !!!

    You're very welcome


    Has someone helped you? Then you can Rate their helpful post.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width