HTML(Input.html-Datei)
<form action="/action_page.php" method="get" id="form1">
<label for="input_text1" id="label1">Name:</label>
<input type="text" id="input_text1">
<input type="submit" id="input_submit1" value="absenden">
</form>
Notes on GET:
- Appends form-data into the URL in name/value pairs
- The length of a URL is limited (about 3000 characters)
- Never use GET to send sensitive data! (will be visible in the URL)
- Useful for form submissions where a user wants to bookmark the result
- GET is better for non-secure data, like query strings in Google
Notes on POST:
- Appends form-data inside the body of the HTTP request (data is not shown in URL)
- Has no size limitations
- Form submissions with POST cannot be bookmarked
POST(machen.php-Datei)
/action_page.php
<?php
$vorname = $_POST["vorname"];
$nachname = $_POST["nachname"];
echo "Hallo $vorname $nachname";
?>