<?php
include("db.php");
error_reporting(0);
if(isset($_REQUEST['register']))
{
$name=$_REQUEST['name'];
$fathername=$_REQUEST['fathername'];
$mothername=$_REQUEST['mothername'];
$cource=$_REQUEST['cource'];
$email=$_REQUEST['email'];
$password=$_REQUEST['password'];
$phone=$_REQUEST['phone'];
$img=$_FILES['img']['name'];
$location="upload/".$img;
copy($_FILES['img']['tmp_name'],$location);
$dob=$_REQUEST['dob'];
$gender=$_REQUEST['gender'];
$address=$_REQUEST['address'];
$query="insert into studentregister(`name`,`fathername`,`mothername`,`cource`,`img`,`email`,`password`,`phone`,`dob`,`gender`,`address`)
values('$name','$fathername','$mothername','$cource','$img','$email','$password','$phone','$dob','$gender','$address')";
$result = mysqli_query($conn,$query);
if($result)
{
echo '<div class="alert alert-success">Form Submitted Successfully</div>';
}
else{
echo '<div class="alert alert-danger">Error Something Went Erong</div>';
}
}
?>
<form action="" method="post" enctype="multipart/form-data" class="pt-5 pb-5" >
<h3>STUDENT REGISTRATION FORM</h3>
<table align="center" class="table-striped table-responsive" cellpadding="12" style="background-color:white; box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);">
<tr>
<td>Name:</td>
<td><input type="text" name="name">
</td>
<td>Father's Name:</td>
<td><input type="text" name="fathername"></td>
</tr>
<tr>
<td>Mother's Name:</td>
<td><input type="text" name="mothername"></td>
<td>Cource</td>
<td><select name="cource">
<option>Select</option>
<?php
$seclect="select * from cource";
$sel=mysqli_query($conn,$seclect);
while($row=mysqli_fetch_array($sel))
{
$cource_id=$row['cource_id'];
$cource=$row['cource'];
?>
<option value="<?php echo $cource; ?>"><?php echo $cource; ?></option>
<?php
}
?>
</select></td>
</tr>
<tr>
<td>Student Image</td>
<td><input type="file" name="img"></td>
<td>Email:</td>
<td><input type="email" name="email"></td>
</tr>
<tr>
<td>Password</td>
<td><input type="password" name="password"></td>
<td>Phone</td>
<td><input type="text" name="phone"></td>
</tr>
<tr>
<td>D.O.B</td>
<td><input type="date" name="dob"></td>
<td>Gender</td>
<td><input type="radio" name="gender" value="male" checked="checked">Male <input type="radio" name="gender" value="female">Female</td>
</tr>
<tr>
<td>Address</td>
<td><textarea name="address"></textarea></td>
</tr>
<tr>
<td colspan="4"><input type="checkbox" required> I agree to the Terms and Conditions
</td>
</tr>
<tr align="center">
<td colspan="1"><input type="submit" value="Submit" name="register"></td>
<td colspan="1"><input type="reset" value="Reset"></td>
</tr>
</table>
</form>
0 Comments