When a form is submitted, values are sent to the server in the form of an HTTP Request. The first call to file_get_contents() prints out the values of the HTTP request. The get and post arrays are used for each type of request. In this case, we are using a post.
<?php echo "file_get_contents(\"php://input\")<br />"; $postdata = file_get_contents("php://input"); echo "{$postdata}<br /><br />"; echo "print_r($_GET)<br />"; print_r($_GET); echo "<br /><br />"; echo "print_r($_POST)<br />"; print_r($_POST); echo "<br /><br />"; echo "var_dump($_GET)<br />"; var_dump($_GET); echo "<br /><br />"; echo "var_dump($_POST)<br />"; var_dump($_POST); echo "<br /><br />"; echo "var_dump($_REQUEST)<br />"; var_dump($_REQUEST); echo "<br /><br />"; ?> <form name="print_this" action="<?php echo htmlspecialchars($_SERVER['PHP_SELF']); ?>" method="post"> <fieldset> <legend>My Controls</legend> Select Your Sacraments:<br /> <select name="sacraments[]" multiple> <optgroup label="Sacraments of Initiation"> <option value="baptism" selected>Baptism</option> <option value="eucharist" selected>Eucharist</option> <option value="confirmation" selected>Confirmation</option> </optgroup> <optgroup label="Sacraments of Healing"> <option value="penance" selected>Penance</option> <option value="anointing">Anointing of the Sick</option> </optgroup> <optgroup label="Sacraments of Service"> <option value="holyorders">Holy Orders</option> <option value="matrimony" selected>Matrimony</option> </optgroup> </select><br /> Hold the <i>Ctrl</i> key for multiple selections.<br /><br /> <input type="text" name="name" value="St. Peter's Basilica" /> <input type="text" name="location" value="Vatican City" /> <input type="submit" /> </fieldset> </form>
© 20072024 XoaX.net LLC. All rights reserved.