POST方法提交表单到php页面的代码示例:

HTML代码:

<form action="submit.php" method="post">
    <input type="text" name="username">
    <input type="password" name="password">
    <input type="submit" value="Submit">
</form>

PHP代码(submit.php):

<?php
    $username = $_POST['username'];
    $password = $_POST['password'];
    
    // 处理表单数据
    // ...
?>

GET方法提交表单到php页面的代码示例:

HTML代码:

<form action="submit.php" method="get">
    <input type="text" name="username">
    <input type="password" name="password">
    <input type="submit" value="Submit">
</form>

PHP代码(submit.php):

<?php
    $username = $_GET['username'];
    $password = $_GET['password'];
    
    // 处理表单数据
    // ...
?>
``
表单使用POST或者GET方法提交到php页面代码示例

原文地址: https://www.cveoy.top/t/topic/hD5h 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录