How to keep already-set GET parameter values on form submission?

后端 未结 7 874
广开言路
广开言路 2020-12-17 08:10

I have a URL : foo.php?name=adam&lName=scott, and in foo.php I have a form which gives me values of rectangleLength & re

7条回答
  •  旧时难觅i
    2020-12-17 08:24

    There are different ways to do this. All of them write the parameters they receive into a file, memory, or a database and retrieve them later with a key

    The easiest method is something like a session variable: http://php.net/manual/en/features.sessions.php

    The main setup is something like this (caution: that is unsecure code, make sure you only add session variables you want to keep, and sanitize user input!):

    $value) {
        $_SESSION[$key]=>$value;
    }
    
    ?>
    

    and now, as long as the user does not close the browser, you can access these variables with $_SESSION[varname];

提交回复
热议问题