简体   繁体   English

通过使用$ _SESSION数组存储多个数据而不在php中使用数据库

[英]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 :) 我应该在m_log.php页面中做什么以显示多个名称,地址,年龄,电子邮件..例如:首先我给输入名称name1,age1,add1,email1 ...它将显示在m_log页面中。然后如果我再次输入像name2,age2,add2这样的名称... name1和name2 age1和age2都将显示在m_log页面中...我不想使用数据库... thnx :)

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. 因此,使您的数据只是临时的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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