Form data print on the other Page using GET, POST and REQUEST after submitting

 <html>

    <head>
        <title>Form Page</title>
    </head>
    <body>
        <form action="testform.php", method="post">
            Name: <input type="text" name="fname"><br><br>
            Age: <input type="text" name="age"><br><br>
            <input type="submit" name="save">
        </form>
    </body>
    // When we send data by form submitting then data will be sent in Array form
</html>



Below is other File(Page)
<?php
// When we send data by form submitting then data will be sent in Array form

// Super Global Variables:
//  $_GET
//  $_POST
//  $_REQUEST
//  $_SERVER
//  $_SESSION
//  $_COOKIE
//  $_FILES

// echo "<pre>";
// print_r($_GET);
// echo "</pre>";

// echo $_GET["fname"] . "<br>";
// echo $_GET["age"];

echo "<pre>";
print_r($_POST);
echo "</pre>";

echo $_POST["fname"] . "<br>";
echo $_POST["age"] . "<br>";

echo "<pre>";
print_r($_REQUEST);
echo "</pre>";
echo "<br>";

echo "<pre>";
print_r($_SERVER);
echo "</pre>";
echo "<br>";

echo $_SERVER["PHP_SELF"] . "<br>";
echo $_SERVER["HTTP_HOST"] . "<br>";
echo "<br>";

echo $_REQUEST["fname"] . "<br>";
echo $_REQUEST["age"] . "<br>";
echo "<br>";

?>





Comments

Popular posts from this blog

Ajax Insert Records in Database Tutorial in PHP

SubQuery with EXISTS and NOT EXISTS in PHP

Submitting HTML Form data in JSON File (without MySql Database) in PHP