Program :
File Name : Student_det.php
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Student Details</title>
</head>
<body>
<form action= "Student_Insert.php" method="post" name="form" id="form">
<table width="563">
<tr height="40">
<td width="20"> </td>
<td width="140"> </td>
<td width="12"> </td>
<td width="298"> </td>
<td width="69"> </td>
</tr>
<tr height="40">
<td> </td>
<td colspan="3" style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:14px; font-weight:bolder;" align="center">Student Details</td>
<td width="69"> </td>
</tr>
<tr height="40">
<td> </td>
<td>Course Code </td>
<td>:</td>
<td>
<select name="Course_Code" id="Course_Code">
<option value="Select">-Select-</option>
<option value="BCS">BCS</option>
<option value="BIT">BIT</option>
<option value="BCT">BCT</option>
<option value="BVC">BVC</option>
<option value="BCD">BCD</option>
<option value="BMA">BMA</option>
<option value="BEN">BEN</option>
</select>
</td>
<td width="69"> </td>
</tr>
<tr height="40">
<td> </td>
<td>Course Name </td>
<td>:</td>
<td>
<select name="Course_Name" id="Course_Name">
<option value="Select">-Select-</option>
<option value="B.Sc Computer Science">B.Sc Computer Science</option>
<option value="B.Sc Information Technology">B.Sc Information Technology</option>
<option value="B.Sc Computer Technology">B.Sc Computer Technology</option>
<option value="B.Sc Visual Communication">B.Sc Visual Communication</option>
<option value="B.Sc Costume Design & Fashion">B.Sc Costume Design & Fashion</option>
<option value="B.Sc Maths">B.Sc Maths</option>
<option value="B.A English Lit">B.A English Lit</option>
</select>
</td>
<td width="69"> </td>
</tr>
<tr height="40">
<td> </td>
<td>Student Register No</td>
<td>:</td>
<td><input name="Reg_No" id="Reg_No" type="text"></td>
<td width="69"> </td>
</tr>
<tr height="40">
<td> </td>
<td>Student Name</td>
<td>:</td>
<td><input name="Stu_Name" id="Stu_Name" type="text"></td>
<td width="69"> </td>
</tr>
<tr height="40">
<td> </td>
<td>Batch</td>
<td>:</td>
<td>
<select name="Batch" id="Batch">
<option value="Select">-Select-</option>
<option value="2012">2012</option>
<option value="2013">2013</option>
<option value="2014">2014</option>
<option value="2015">2015</option>
<option value="2016">2016</option>
<option value="2017">2017</option>
<option value="2018">2018</option>
<option value="2019">2019</option>
<option value="2020">2020</option>
</select>
</td>
<td width="69"> </td>
</tr>
<tr height="40">
<td> </td>
<td>Gender</td>
<td>:</td>
<td>
<select name="Gender" id="Gender">
<option value="Select">-Select-</option>
<option value="Male">Male</option>
<option value="Female">Female</option>
</select>
</td>
<td width="69"> </td>
</tr><tr height="40">
<td> </td>
<td>Father's Name</td>
<td>:</td>
<td><input name="Father_name" id="Father_name" type="text"></td>
<td width="69"> </td>
</tr><tr height="40">
<td> </td>
<td>Community</td>
<td>:</td><td>
<select name="Community" id="Community">
<option value="Select">-Select-</option>
<option value="OC">OC</option>
<option value="BC">BC</option>
<option value="MBC">MBC</option>
<option value="SC/ST">SC/ST</option>
</select></td>
<td width="69"> </td>
</tr><tr height="40">
<td> </td>
<td>Address</td>
<td>:</td>
<td><textarea name="Address" id="Address" rows="4" cols="25"></textarea></td>
<td width="69"> </td>
</tr><tr height="40">
<td> </td>
<td colspan="3"><center class="style5">
<center>
<input type="submit" name="Insert" id="Insert" value="Insert" >
</center>
</td><td> </td>
</tr>
</table>
</form>
</body>
</html>
File name : Student_Insert.php
<?php$Course_Code=$_POST['Course_Code'];
$Course_Name=$_POST['Course_Name'];
$Reg_No=$_POST['Reg_No'];
$Stu_Name=$_POST['Stu_Name'];
$Batch=$_POST['Batch'];
$Gender=$_POST['Gender'];
$Father_name=$_POST['Father_name'];
$Community=$_POST['Community'];
$Address=$_POST['Address'];
$con=mysql_connect("localhost","root","");
mysql_select_db("StudentDB",$con);
$sql="insert into StuDet values('$Course_Code','$Course_Name','$Reg_No','$Stu_Name','$Batch','$Gender','$Father_name','$Community','$Address')";
$result=mysql_query($sql,$con);
if ($result)
{
echo "Details added to the Database Successfully . . . ";
}
else
{
echo "Failed . . . ";
}
?>
0 comments:
Post a Comment