TY_BCA_AWT_SLIP 12_2

12.   Create student table as follows Student(sno, sname, per).
Write Ajax program to select the student name and print the selected student’s details.
  ===============================================================
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>";
}
?>

1 comment:

  1. sir can u tell me why you haven't took the sno and per in the form ?

    ReplyDelete

Note: only a member of this blog may post a comment.