© Mikael Olsson 2021
M. OlssonPHP 8 Quick Scripting Referencehttps://doi.org/10.1007/978-1-4842-6619-9_23

23. User Input

Mikael Olsson1  
(1)
Hammarland, Finland
 

When an HTML form is submitted to a PHP page, the data becomes available to that script.

HTML Form

An HTML form has two required attributes: action and method. The action attribute specifies the script file to which the form data is passed when the form is submitted. For example, the following form submits one input property called myString to the mypage.php script file.
<?php // myform.php ?>
<!doctype html>
<html>
<body>
  <form action="mypage.php" method="post">
    <input type="text" name="myString">
    <input type="submit">
  </form>
</body>
</html>

The second required attribute of the form element ...

Get PHP 8 Quick Scripting Reference: A Pocket Guide to PHP Web Scripting now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.