PHP

Send and retrieve values with $_REQUEST


Send and receive values with $_REQUEST

Example form to test $_REQUEST

Code example for a form to send $_REQUEST

<html>
<head></head>

<body>
    
    <?php

        setcookie('username_cookie','developer_usr');

    ?>

    <form method= "post" action="09_request_values.php?admin_get=administrator&profile=administrator2">

        Insert the username:<br/>

        <input type="text" name="username_dev">

        <input type="hidden" name="profile_hidden" value="admin">

        <input type="submit" name="submit_button"  value="submit">

    </form>

</body>


</html>
File that will receive the values

We add the code next for the file that will receive the $_REQUEST values

<?php

// Cookies are not included

var_dump($_REQUEST);