Home > Backend Development > PHP Problem > How to submit HTML form to PHP file

How to submit HTML form to PHP file

藏色散人
Release: 2023-02-28 09:20:02
Original
6283 people have browsed it

How to submit HTML form to PHP file

How to submit HTML form to PHP file?

The first step is to create a folder form in the www directory, and create the files form_submit.html and receive.php in the folder.

How to submit HTML form to PHP file

The second step is to open the file form_submit.html and enter the code. This code mainly uses the form form, and the method attribute of the form form is "post". Note that the encoding format must be set correctly, otherwise garbled characters will appear.

How to submit HTML form to PHP file

The third step is to open the file receive.php and enter the code. The code mainly uses PHP's built-in function $_POST().

How to submit HTML form to PHP file

The fourth step is to open the file form_submit.html in the browser and enter the data to submit. You can jump to the php page and display the data.

How to submit HTML form to PHP file

How to submit HTML form to PHP file

In form_submit.html, if the method attribute of the form form is set to "get", then receive.php will use Built-in function $_GET().

How to submit HTML form to PHP file

Notes

The utf8 format must be set in both files, otherwise garbled characters will appear

Also use the built-in function $_REQUEST () to achieve the same effect.

For more PHP related knowledge, please visit PHP Chinese website!

The above is the detailed content of How to submit HTML form to PHP file. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template