form post html code example
Example 1: posting with forms html
<form method="POST" action="INSERT WHERE YOU'RE SENDING THE DATA TO HERE">
<input type="text" name="INSERT DATA KEY NAME HERE"> <!-- You don't have to have this line -->
</form>
Example 2: html form post
<form action="/yourPage" method="post">
</form>
Example 3: html form
<form action="/action.php">
<label for="fname">First name:</label><br>
<input type="text" id="fname" value="Mike"><br><br>
<label for="lname">Last name:</label><br>
<input type="text" id="lname" value="Walker"><br><br>
<input type="submit" value="Submit">
</form>
Html By Duco Defiant Dogfish on Feb 11 2020
<form action="/action_page.php">
First name:<br>
<input type="text" name="firstname" value="Mickey"><br>
Last name:<br>
<input type="text" name="lastname" value="Mouse"><br><br>
<input type="submit" value="Submit">
</form>
Example 4: how to access form data usinf method get
if ( isset( $_POST['submit'] ) ) {
echo '<h2>form data retrieved by using the $_REQUEST variable<h2/>'
$firstname = $_REQUEST['firstname'];
$lastname = $_REQUEST['lastname'];
echo 'Your name is ' . $lastname .' ' . $firstname;
if ( filter_has_var( INPUT_POST, 'submit' ) ) {
echo '<h2>form data retrieved by using $_POST variable<h2/>'
$firstname = $_POST['firstname'];
$lastname = $_POST['lastname'];
echo 'Your name is ' . $lastname .' ' . $firstname;
}
if ( filter_has_var( INPUT_GET, 'submit' ) ) {
echo '<h2>form data retrieved by using $_GET variable<h2/>'
$firstname = $_GET['firstname'];
$lastname = $_GET['lastname'];
}
echo 'Your name is ' . $lastname .' ' . $firstname;
exit;
}