简体   繁体   中英

storing multiple data by using $_SESSION array without using database in php

i want to store multiple data by using session array from one page to another......here is my code:

<?php

    session_start();
    $_SESSION['login_status'] = false;

?>
<html>

    <title> Registration  </title>

    <body>

        <form method="post" action="multiple_login.php">

            Name:<input type="text" name="Name"> </br>
            Age:<input type="numeric" name="age"> </br>
            Address: <input type="text" name="add"> </br>
            Email: <input type = "text" name="email"> </br>
            Password: <input type = "password" name="pass"> </br>
            Re-type password: <input type = "password" name="r_pass"> </br>
                   <input type="submit" value="Sign up">



        </form>


    </body>


</html>


<?php





    if($_POST){


        $_SESSION["user"] = array(
        "name" => $_POST["name"],
        "email" => $_POST["email"],
        "password" => $_POST["pass"]
    );

        $_SESSION['login_status'] = false;

            ?>

            <script>
                window.location = "http://localhost/login/m_log.php";
            </script>

            <?php

           // }
    }       
?>

what am i supposed to do in m_log.php page for showing multiple names,addresses,ages,emails.. for example: frst i give input name1,age1,add1,email1...it will show in the m_log page..and then if i again give input like name2,age2,add2... both name1 and name2 age1 and age2 will be shown in the m_log page...i don't want to use the database...thnx in advance :)

I advise you to make a database for this. Because sessions are being destroyed once the browser is closed. Thus, making your data only temporary.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM