2024年06月06日 建站教程
html表单:
<form action="form.php" method="post"> <input type="text" name="username" placeholder="Username"> <input type="passWord" name="password" placeholder="Password"> <input type="submit" value="Submit"> </form>
php处理脚本:
<?php // 获取表单数据 $username = filter_input(INPUT_POST, "username"); $password = filter_input(INPUT_POST, "password"); // 验证数据 if (empty($username) || empty($password)) { // 显示错误消息 echo "Please fill out all fields."; } else { // 处理数据 // 显示成功消息 echo "Form submitted successfully."; } ?>
本文链接:http://so.lmcjl.com/news/6054/