How to use session uniquely each time page loads?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • phpchild
    New Member
    • Jan 2013
    • 2

    How to use session uniquely each time page loads?

    i want to use unique session values, set according to if condition. To use in same page.
    Like this
    Code:
    <?php
    
    session_start();
    ?> <form action="http://bytes.com/nn.php" method="post">
    Username: <input type="text" name="lname"  /><br><br>
    Password: <input type="password" name="password" /><br><br> <input type="submit" name="submit"/> </form> <?php if(isset($_POST['submit']) && $_POST['submit'])
    {
    echo "ok";
    $_SESSION['a']="same";
    
    }
    echo $_SESSION['a'];
    
    
    
    ?>
    But each time i load the page, i get the same session values even before i click submit button..
    Any Help greatly appreciated.. Thanks in advances
    Last edited by acoder; Jan 13 '13, 09:33 PM. Reason: Please use [code] tags when posting code
  • Exequiel
    Contributor
    • Jul 2012
    • 288

    #2
    Code:
    if($_SESSION['user']=='' && $_SESSION['pwd']==''){
         echo 'Stay here.';
    }else{
         echo 'Success';
    }
    Try this. . .

    Comment

    Working...