Slip 5 - B) Create student table as follows: Student(sno, sname, standard, Marks, per). Write AJAX script to select the student name and print the student’s details of particular standard.

 Solution:

Html file :

<html>
<body>
<form action="slip_12.php" method="get">
Enter student name Name:<input type="text" name=sname><br>
<input type="submit" value=submit>
</form>
</body>
</html>

Php file :

<?php
$sname=$_GET['sname'];
$con=mysql_connect("localhost","root","");
$d=mysql_select_db("bca_programs",$con);
$result=mysql_query("select *from student where sname='$sname'");
while($row=mysql_fetch_array($result))
{
echo $row['sno']."--".$row['sname']."--".$row['per']."<br>";
}
?>

Post a Comment

0 Comments