PHP receives Post Data

Source: Internet
Author: User

Method 1:
If there is a form like this:
[Code]

[/Code]
You can get the content of the test input box through: $ _ post ['test']. Here, test is the name of input.
If you enter ABC in the file box to submit, $ _ post ['test'] = ABC;
Method 2:
Use PHP: // input to obtain all post data. Sample Code to save the data stored in post.txt:
[Code]
If ($ _ server ["request_method"] = "Post ")
{
$ Filename = "post.txt ";
$ Somecontent = file_get_contents ("PHP: // input ");

If (is_writable ($ filename ))
{
If (! $ Handle = fopen ($ filename, 'A '))
{
Echo "the file $ filename cannot be opened ";
Exit;
}
If (fwrite ($ handle, $ somecontent) === false)
{
Echo "Write failed ";
}
Else
{
Echo "Write successful ";
}
}
Else
Echo "files cannot be written ";
Fclose ($ handle );
}
?>
[/Code]

Reproduced from: http://www.baiyuxiong.com /? P = 29

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.