这是包含表单本身的 index.php 页面:
<html>
<body>
<form action="registeraction.php" method="post">
First Name: <input type="text" name="fname"><br>
Last Name: <input type="text" name="lname"><br>
Email Address: <input type="text" name="emaddress"><br>
Confirm Email Address: <input type="text" name="confirmemaddress"><br>
Password: <input type="password" name="pword"><br>
Confirm Password: <input type="password" name="confirmpword"><br>
<input type="submit">
</form>
</body>
</html>
这是我处理表单的 registeraction.php 页面:
<?php
$con=mysqli_connect("localhost", "root", "", "registration_info");
//Check Connection
if (mysqli_connect_errno ())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
mysqli_query($con,"INSERT INTO Registration_Basics (fname, lname, emaddress,
confirmemaddress, pword, confirmpword)
VALUES
('$_POST[fname]','$_POST[lname]','$_POST[emaddress]','$_POST[confirmemaddress]',
'$_POST[pword]', '$_POST[confirmpword]')";
if (!mysqli_query($con,$sql))
{
die('Error: ' . mysqli_error($con));
}
echo "1 Record Added";
mysqli_close($con);
?>
这是我在使用表单中的所有信息运行 registeraction.php 文件时遇到的错误:Parse error: syntax error, unexpected ';' 在第 11 行的 C:\xampp\htdocs\TutorialBoy\registeraction.php