This article introduces some of the form's knowledge points, then describes how PHP receives form data and how to process the form data, the article with a Send mail form instance to explain to you the form submission and PHP how to process the form data, the need for friends can refer to the next
First look at the source code of the HTML form form:
The form starts with <form> and ends with </form>.
The action represents the file to which the form is submitted for processing data, which is submitted to the feedback.php file for processing form data.
Method means that the form is submitted in such a way that there are generally two ways to submit the form, the Post method, and the Get method. The Get method submits the form, the data is displayed on the URL link, the form is submitted by post, the data is hidden, and is not displayed on the URL link.
In this example, there are many HTML input tags, all of which are form elements.
The code for working with the form data in PHP is as follows:
<?php$username = $_post[' username '); $useraddr = $_post[' useraddr ']; $comments = $_post[' comments ']; $to = "Php@h.com" ; $re = "Website Feedback"; $msg = $comments; $headers = "mime-version:1.0\r\n"; $headers. = "content-type:text/html; Charset=iso-8859-1\r\n "; $headers. =" From: $useraddr \ r \ n "; $headers. = "cc:another@hotmail.com \ r \ n"; Mail ($to, $re, $msg, $headers); >
Because the form is submitted as post, this is the use of $_post to get form data.
The above is the whole content of this article, I hope that everyone's study has helped.