PHP form submission and processing form data detailed

Source: Internet
Author: User
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.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.