PHP

Post form and $_POST values in PHP


Retrieve post and send post values form

Form to send values with POST Method

Code example of form to send POST values to a different php file

<html>
<head>

</head>

<body>
    <form method="post" action="07_post_values.php">

    Enter your name:<br/>

    <input type="text" size "50" name="user_name"><br/>

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

    </form>
</body>


</html>
File that will receive the POST values

Example of POST form that will receive the values

<?php

// File : 07_post_values.php

if ($_POST["submit"]) {

    $user_name = $_POST["user_name"];

    echo "The Username is : ".$user_name. "<br/>";

} else {

    echo "Form was not submitted";
}

?>

<a href="06_post_form.php">Back</a>