When I click a button to insert the data into the database by implementation of PHP code , but the problem is that it opens a new tab and shows PHP codes
html code
<html>
<body>
<form action="InsertStudent.php" method="post">
Student Id: <input type="text" name="SId" />
Student Name:<input type="text" name="SName" />
Marks: <input type="text" name="marks" />
<input type="submit" value= "Insert"/>
</form>
</body>
</html>
PHP code
<?php
$con = mysql_connect("localhost","root","1234");
if (!$con)
{
die('Could not connect:'.mysql_error());
}
mysql_select_db("my_db",$con);
mysql_query("INSERT INTO Student(StudId,StudName,Marks)
VALUES ('9876543', 'Ahmed', '90')");
mysql_query("INSERT INTO Student(StudId,StudName,Marks)
VALUES ('12344556', 'Mohammed', '95')");
mysql_close($con);
?>