17.1 Introduction to forms. An HTML form is a section of a document containing normal content, markup, special elements called controls (checkboxes, radio buttons.
There is nothing special about this form. It is a straight HTML form with no special tags of any kind. When the user fills in this form and hits the submit button.
One of the most powerful features of PHP is the way it handles HTML forms. The basic concept that is important to understand is that any form element will automatically be available to your PHP scripts. Please read the manual section on Variables from external sources for more information and examples on using forms with PHP. Here is an example HTML form: Apart from the htmlspecialchars() and (int) parts, it should be obvious what this does. htmlspecialchars() makes sure any characters that are special in html are properly encoded so people can't inject HTML tags or Javascript into your page. For the age field, since we know it is a number, we can just convert it to an integer which will automatically get rid of any stray characters. You can also have PHP do this for you automatically by using the filter extension. The $_POST['name'] and $_POST['age'] variables are automatically set for you by PHP. Earlier we used the $_SERVER superglobal; above we just introduced the $_POST superglobal which contains all POST data. Notice how the method of our form is POST. If we used the method GET then our form information would live in the $_GET superglobal instead. You may also use the $_REQUEST superglobal, if you do not care about the source of your request data. It contains the merged information of GET, POST and COOKIE data. You can also deal with XForms input in PHP, although you will find yourself comfortable with the well supported HTML forms for quite some time. While working with XForms is not for beginners, you might be interested in them. We also have a short introduction to handling data received from XForms in our features section. According to the HTTP specification, you should use the POST method when you're using the form to change the state of something on the server end. For example, if a page has a form to allow users to add their own comments, like this page here, the form should use POST. If you click "Reload" or "Refresh" on a page that you reached through a POST, it's almost always an error -- you shouldn't be posting the same comment twice -- which is why these pages aren't bookmarked or cached. You should use the GET method when your form is, well, getting something off the server and not actually changing anything. For example, the form for a search engine should use GET, since searching a Web site should not be changing anything that the client might care about, and bookmarking or caching the results of a search-engine query is just as useful as bookmarking or caching a static HTML page. @sethg at ropine dot com You're partially right. For many people, the difference between POST/GET is about whether data is sent as a URL query (GET) or as a HTTP request payload together with headers (POST) and in most cases it is used so with regards to that. In case of forms the difference between GET and POST has more to do with convenience and the fact that both methods fit to certain use cases and not with the fact whether a some resource is created/changed on the server or not (eg. login forms use POST method mainly to not expose sensitive data in URL etc.). It all depends on the back-end implementation what really happens after GET or POST request is received. GET is good if you want the request to be cacheable and/or bookmarkable. In most HTML form cases though, POST seems always better, especially when we deal with long data (eg. forum post). To be strict about HTTP verbs, POST verb usually means creation of new resource while to update an existing resource, the PUT method is used (not applicable in case of HTML forms except some additional hidden "method" form fields). Those who are not familiar with HTTP verbs shall dive into HTTP specs (RFC 2616, section "9 Method Definitions") and read a bit about REST.
Well organized and easy to understand Web bulding tutorials with lots of examples of how to use HTML, CSS, JavaScript, SQL, PHP, and XML.
(HTML 2.0) - Form. Используется для создания заполяемой формы. Необходимо присутствие начального.
Declaración de formularios. Manual de HTML. Tutorial de HTML. WebEstilo. Manual de HTML Facil. Aprender HTML de una manera facil y sencilla, con muchos ejemplos.
Dealing with Forms