POST请求:
html代码:
<form action="" method="post">
<label for="email">邮箱:</label>
<input type="email" id="email" name="email" value="<?php echo isset($_POST['email']) ? $_POST['email'] : ''; ?>">
<label for="password">密码:</label>
<input type="password" id="password" name="password" value="<?php echo isset($_POST['email']) ? $_POST['email'] : '';?>">
<button>登录</button>
</form>`
PHP代码:
<?php
print_r($_POST);
echo $_POST['email'];
if (isset($_POST['email'])) {
echo $_POST['email'];
} else {
$_POST['email'] = '';
}
echo isset($_POST['email']) ? $_POST['email'] : '';
echo '<pre>';
print_r($_POST);
?>