www.webdeveloper.com
Results 1 to 5 of 5

Thread: How to redirect page after successful log in?

  1. #1
    Join Date
    Apr 2014
    Posts
    2

    Question How to redirect page after successful log in?

    How to redirect page after successful log in in HTML?

    what form codes should i type?
    what PHP codes should i type?

    newbie ir..

  2. #2
    Join Date
    May 2012
    Location
    India
    Posts
    21
    Quote Originally Posted by heartlock View Post
    How to redirect page after successful log in in HTML?

    what form codes should i type?
    what PHP codes should i type?

    newbie ir..
    Do not send any html code from the server , the browser should not receive any html codes then just in that case use the below tag to redirect to example.com you can change example.com to anything you want.

    header('Location: http://www.example.com/');

    Hope it helps ....

    ALL THE BEST

  3. #3
    Join Date
    Mar 2012
    Posts
    1,405
    Just to clarify. There must not be any html code before the header command, not even a blank line:
    Code:
    <?php
    header('Location: http://www.example.com/');
    exit;
    ?>
    Last edited by jedaisoul; 04-30-2014 at 05:45 PM.

  4. #4
    Join Date
    May 2012
    Location
    India
    Posts
    21

    Thumbs up

    To heartlock
    Sorry for the late reply , internet connection was down in my area ... yes not any html code and I think u need not to have exit after the header command .....

    To make it more clear let me just explain u with little example ....

    You made login.php your default page showing login form and it post data to another php say loginvalidate.php do your validation in this script and in the same script send the html data as "SORRY NOT A VALID USERNAME AND PASSWORD" in case of not logged in then the whole login process will freeze on this script its optional to add a back link and if the user gets validated then you can just place this command as header('Location: http://yoursite.com/home.php'); or maybe i think even this will work header('Location: home.php'); in this way you are sending html only if the user is not validated but if it gets validated then simply the home.php will open you will not even get a chance to notice the route to home.php through validate.php .....

    HOPE IT HELPS ....

    I HOPE I MADE MYSELF CLEAR AND YOUR DOUBTS TOO ...

    ALL THE BEST.....
    Last edited by jayantgeek; 05-02-2014 at 12:08 PM.

  5. #5
    Join Date
    May 2012
    Location
    India
    Posts
    21
    To heartlock


    i would like to ask you...
    Are you trying to make some script like this site(webdeveloper.com) does on login i.e. it shows a message thankyou for login and says you will automatically be redirected to home page ..... if browser does not automatically does so click and it gives you a link to home page......
    Last edited by jayantgeek; 05-02-2014 at 12:09 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles