-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconnect.php
31 lines (30 loc) · 1.37 KB
/
connect.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
if($_SERVER["REQUEST_METHOD"]=="POST" && isset($_POST["submit"])){
$conn= mysqli_connect('localhost','root','','hmsys') or die("Connection failed:" .mysqli_connect_error());
if(isset($_POST['name']) && isset($_POST['regno']) && isset($_POST['email']) && isset($_POST['phoneno']) && isset($_POST['password']) && isset($_POST['confirmpassword']) && isset($_POST['gender']) ){
$name=$_POST['name'];
$email=$_POST['email'];
$regno=$_POST['regno'];
$phoneno=$_POST['phoneno'];
$password=$_POST['password'];
$confirmpassword=$_POST['confirmpassword'];
$gender=$_POST['gender'];
session_start();
$sql="INSERT INTO `users` (`name`,`regno`,`email`,`phoneno`,`password`,`gender`,`block`)VALUES ('$name','$regno','$email','$phoneno','$password','$gender','NULL')";
$query=mysqli_query($conn,$sql);
if($query){
echo 'Entry successful';
$_SESSION['regno'] = $regno;
if( $gender=="male"){
header('Location: student\bhregistration.php');
}
else if($gender=="female"){
header('Location: student\ghregistration.php');
}
}
else{
echo "error occoured";
}
}
}
?>