我试图使用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