Form the basis of use

login.php (client form page)

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>用户登录</title>
</head>
<body>
  <form action="foo.php" method="post">
    <table border="1">
      <tr>
        <td>用户名</td>
        <td><input type="text" name="username"></td>
      </tr>
      <tr>
        <td>密码</td>
        <td><input type="text" name="password"></td>
      </tr>
      <tr>
        <td></td>
        <!-- input: submit image -->
        <!-- button -->
        <td><button>登录</button></td>
      </tr>
    </table>
  </form>
</body>
</html>

① must form tag

②form must specify the action and method

  Do not set the default action is the current page (must be set, because compatibility issues)

  Do not set the default method is get

③ form elements (form fields, input, etc.) must have a name, then if it wishes to be submitted

④ form must have a submit button

 

foo.php (submitted receives service parameters)

<?php
    
var_dump($_GET);

//var_dump($_POST);
//var_dump($_REQUEST);

① $ _GET submit the URL address for receiving data (typically GET parameter)

② $ _POST data volume for receiving a request submitted (usually submitted POST data)

③$_REQUEST = $_POST + $_GET

Guess you like

Origin www.cnblogs.com/shanlu0000/p/11580681.html