我試圖使用PHP的形式MySQL數據庫使用XAMPP連接一個HTML頁面的PHP MySQL連接。在HTML頁面工作正常,但只要我按下提交按鈕的網頁具有鮮明的人物出現時,任何人可以用問題幫助[PHP頁面] [1]錯誤使用XAMPP
HTML代碼:?!
<html>
<body>
<body bgcolor="black">
<font color="white">
<form action="a.php" method="post">
<center>
<h1><font color = "gold"><marquee>Welcome to online bus booking!!!</h1></marquee> </font color>
<h3>
First Name:<br><input type = "text" name = "fnm"><br>
Last name:<br><input type = "text" name = "lnm"><br>
Mobile:<br><input type = "text" name = "mob"><br>
Age:<br><input type = "number" name = "age"><br>
Source:<input type = "text" name = "src">
Destination:<input type = "text" name = "des"><br>
<font color="orange">Passenger Address:<br></font color>
Street:<br><input type = "text" name = "str"><br>
Area:<br><input type = "text" name = "area"><br>
City:<br><input type = "text" name = "cty"><br>
<input type = "submit">
</h3>
</center>
</form>
</body>
</html>
PHP代碼:
<?php
$con=mysqli_connect("localhost","root","","testdb");
if(mysqli_connect_error())
{
echo "FAILED" . mysqli_connect_error();
}
$sql="INSERT INTO exp VALUES('$_POST[fnm]', '$_POST[lnm]', $_POST[mob], $_POST[age], '$_POST[src]', '$_POST[des]', '$_POST[str]', '$_POST[area]', '$_POST[cty]')";
if (!mysqli_query($con,$sql))
{
die('Error: ' . mysqli_error($con));
}
echo "1 record added";
mysqli_close($con);
?>
哪裏是你的PHP代碼? – iatboy 2014-10-04 02:26:27
什麼是「具有鮮明的字符的頁面」? – 2014-10-04 02:28:13
@iatboy我已將php代碼 – 2014-10-04 02:32:21