I'm trying to connect a HTML page using PHP form to MySQL database using Xampp. The HTML page is working fine but as soon as I press submit button a page with distinct characters appears, can anybody help with the problem?![php page][1]
HTML code:
<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 code:
<?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);
?>
ì XõKöòúûnDUA*å)YïÌììăÑÚšl 1iïJÖ/z,'½ÒnV²ÉK~ϲ„Â)a¼ƒ’m ±Ñðúj0ÙHu»T²9bxà<É9X�? ÀQ¥òÑ ¤×8ãAÈO1~ÛëÝqé‚Ãk6$N{9›êÍ+P9Y ¢†vuÇGD²ìÃï»ÆoR€”wàͳ¶ ÌIÊŠ~‰‰˜8›ïWòZè“"V0}¿˜ûßÀ»„´ù“>þÁŒýuQwHoî·áÿÿPK!�?·óN_rels/.rels ¢( Œ’ÛJA†ïßaÈ}7Û "ÒÙÞH¡w"ë„™ìw̤ھ½£ ºPÛ^æôçËOÖ›ƒ›Ô;§<¯aYÕ Ø›
Gßkxm·‹PYÈ[š‚g GΰinoÖ/<�?”¡<Œ1«¢â³†A$>"f3°" and so on