我是网页设计的初学者。我有一个数据库设置,只想使用 PHP 将表单数据插入我的数据库。我有这样的代码,但是当单击提交按钮时,它会转到 PHP 代码页。需要帮忙。谢谢
<!DOCTYPE html>
<html>
<body>
<form name="input" action="test.php" method="post">
First name: <input type="text" name="FirstName" value="Mickey"><br>
Last name: <input type="text" name="LastName" value="Mouse"><br>
<input type="submit" value="Submit">
</form>
<?php
if(isset($_POST['sumit'])){
$Fname=$_POST['FirstName'];
$Lname=$_POST['LastName'];
mysql_connect("server", "xxxxxx", "xxxxxx") or die(mysql_error());
mysql_select_db("test_name") or die(mysql_error());
mysql_query("INSERT INTO `FirstName`,'LastName' VALUES ('$Fname', '$Lname')");
Print "Your information has been successfully added to the database."; }
?>
<p>If you click the "Submit" button, the form-data will be sent to a my test table test_name.</p>