Home > Article > Backend Development > What is the php form submission method?
php form submission method: 1. Use PHP $_REQUEST to collect the data submitted by the HTML form; 2. Use $_POST to collect the form data after submitting the HTML form with "method="post""; 3. Use $ _GET collects data submitted by an HTML form.
The operating environment of this article: windows7 system, PHP7.1 version, DELL G3 computer
php form submission method
1. Collect data submitted by HTML forms, PHP $_REQUEST is used to collect data submitted by HTML forms.
<!DOCTYPE html> <html> <body> <form method="post" action="<?php echo $_SERVER['PHP_SELF'];?>"> #$_SERVER['PHP_SELF']是获取当前文件的路径 Name: <input type="text" name="fname"> <input type="submit"> </form> <?php $name = $_REQUEST['fname']; #$_REQUEST['fname']获取前面name="fname"的输入值 echo $name; ?> </body> </html>
2.PHP $_POST is widely used to collect form data after submitting an HTML form with method="post". $_POST is also commonly used to pass variables.
<html> <body> <form method="post" action="<?php echo $_SERVER['PHP_SELF'];?>"> Name: <input type="text" name="fname"> <input type="submit"> </form> <?php $name = $_POST['fname']; echo $name; ?>
#action here can be modified to other php files to process the submitted data
html file
php file
##3.PHP $_GET can also be used to collect form data after submitting an HTML form (method="get").$_GET can also collect data sent in the URL.
The second method of getting submission information
Postscript: When writing Chinese, an exception will appear. Add 64de5ac3a53af78f54f5fb1b525d83be Thenrecommended learning: "PHP Video Tutorial"
The above is the detailed content of What is the php form submission method?. For more information, please follow other related articles on the PHP Chinese website!