Sending variables from one PHP page to another

后端 未结 3 1366
长情又很酷
长情又很酷 2021-01-24 17:04

I\'m building a quiz web application that is dynamically generated from a database on my server. I have pretty much implemented all the functionality, the only missing piece is

3条回答
  •  -上瘾入骨i
    2021-01-24 17:33

    To "send" values from one PHP page to another, you can use sessions or GET variables sent in the url.

    Sessions:

    $_SESSION["quiz_id"] = 1;
    $_SESSION["quiz_title"] = "geography";
    

    URL: mypage.php?quiz_id=1&quiz_title=geography

    $quiz_id = $_GET["quiz_id"];
    $quiz_title = $_GET["quiz_title"];
    

    To send values from the client to the server, you will have to use an HTML form or AJAX.

提交回复
热议问题