創建的表單顯示單擊提交時在URL中發送的數據,但發送到服務器的唯一部分是用戶名/ $ un。所有的表單輸入都被忽略。表單數據未被髮送到服務器
HTML表單:
<form action="CharacterAdd.php">
<legend>Add Character</legend>
Character Name:<br>
<input type="text" name="Name" >
<br>
Gender:<br>
<input type="text" name="Gender" >
<br>
Age:<br>
<input type="text" name="Age" >
<br>
Hobbies:<br>
<input type="text" name="Hobby" >
<br>
Home:<br>
<input type="text" name="Home" >
<br>
Job:<br>
<input type="text" name="Job" >
<br>
<input type="submit" value="Submit">
<p>
<br>
</form>
PHP代碼:
$un = $_SESSION["gatekeeper"];
$a = htmlentities($_POST['Name']);
$b = htmlentities($_POST['Gender']);
$c = htmlentities($_POST['Age']);
$d = htmlentities($_POST['Hobby']);
$e = htmlentities($_POST['Home']);
$f = htmlentities($_POST['Job']);
$g = htmlentities($_POST['$un']);
{
$statement = $conn->prepare("INSERT INTO Characters(Name,Gender,Age,Hobby,Home,Job,username) VALUES (?,?,?,?,?,?,?)");
$statement->bindParam(1,$a);
$statement->bindParam(2,$b);
$statement->bindParam(3,$c);
$statement->bindParam(4,$d);
$statement->bindParam(5,$e);
$statement->bindParam(6,$f);
$statement->bindParam(7,$un);
$statement->execute();
$conn->query ($charac);
你在哪裏關閉'