php session post problem

Discussion in 'PHP' started by akshaygupta5555, Jan 20, 2008.

  1. #1
    /////////////temp1.php//////////////

    <?php
    session_start();
    echo "<title>akshay</title>";
    $username=$_POST['username'];

    echo "$username";

    echo "<form name=one action=temp1.php method=post>";
    echo "Username <input type=text name=username><br>";
    echo "<input type=submit>";
    echo "<a href=http://www.financialanalyststudy.com/a.php>Navigate</a>";

    ?>

    ////////////////a.php/////////////////
    <?php
    session_start();
    echo session_id();

    ?>


    the error occurs in Internet explorer and not in firefox

    the above is the script of two file temp1.php and a.php

    submit the data in temp1.php
    it shows the username
    then i click the navigate hyper link to go to a.php
    then i click the back button on the browser tool bar to return to temp1.php
    and i get "The page cannot be displayed" when i refresh i get the username again with the seesion.
     
    akshaygupta5555, Jan 20, 2008 IP
  2. jayshah

    jayshah Peon

    Messages:
    1,126
    Likes Received:
    68
    Best Answers:
    1
    Trophy Points:
    0
    #2
    The The page cannot be displayed error could be caused as you are trying to re-post the data to get the username.
     
    jayshah, Jan 20, 2008 IP
  3. akshaygupta5555

    akshaygupta5555 Member

    Messages:
    11
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    36
    #3
    i would like you to elaborate on it with a small example
     
    akshaygupta5555, Jan 20, 2008 IP
  4. Capix

    Capix Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    He means, when you go back, you get "The page cannot be displayed error " because you have used $_POST[''] submit before.
    If you used $_GET[''], then you will see the page just fine.
     
    Capix, Jan 20, 2008 IP
  5. akshaygupta5555

    akshaygupta5555 Member

    Messages:
    11
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    36
    #5
    i want to do it using post itself $_POST['']
     
    akshaygupta5555, Jan 22, 2008 IP
  6. Capix

    Capix Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    There is no real other way unless you do it with GET or SESSIONS.

    Other then that, good luck.
     
    Capix, Jan 22, 2008 IP