CHAPTER 23

image

User Input

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 specified the script to which the form data is passed. For example, the following form submits one input property called myString to the script file MyPage.php.

<html><body>  <form action="MyPage.php" method="post">    <input type="text" name="myString" />    <input type="submit" />  </form></body></html>

The other required attribute of the form element specifies the sending method, which may be either get or post.

Sending with post

If the form ...

Get PHP Quick Scripting Reference 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.