我想创建一个表单并将表单的值与数据库匹配。我已经尝试过,但我失败了并且有一个奇怪的错误。CSRF 状态令牌与提供的不匹配。我是新手,需要一些帮助
<?php
header('P3P: CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM"');
include_once "fbmain.php";
include_once "mysqli.connect.php";
mysql_connect(".....") or die(mysql_error()) ;
mysql_select_db("jetstardatabase") or die(mysql_error()) ;
?>
<html>
<link type= "text/css" rel="stylesheet" href="starpickStyle.css">
<head>
<title>StarPick</title>
</head>
<body>
<?php
if (!isset($_POST["code"]))
{
?>
<form action="" method="post">
<strong>Code: *</strong> <input type="text" name = "code" >
<input type="submit" name="submit" value="Submit">
</form>
<?php
}else
{
$code = $_POST["code"]; }
$sql = "SELECT bookingref FROM starpick WHERE obsolete = 0";
$result = $mysqli->query($sql);
while($row = $result->fetch_object())
{
if($row->bookingref == $code)
{
echo 'Found';
}
else
{
echo 'Try Again';
}
}
?>
</body>
</html>