forked from nihalsrivastava02/Hackathon-2.0
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuser_registration.php
More file actions
35 lines (34 loc) · 1023 Bytes
/
user_registration.php
File metadata and controls
35 lines (34 loc) · 1023 Bytes
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
32
33
34
35
<?php
error_reporting(E_ALL^E_NOTICE);
if(!$_SESSION['u_type']== 'A')
{
die("Invalid user");
}
?>
<?php
require_once("db_connection.php");
$id=$_POST["id"];
$u_name=$_POST["u_name"];
$u_password=$_POST["u_password"];
$u_type=$_POST["u_type"];
$department=$_POST["department"];
if($_POST["designation"] != "Designation")
{
$designation=$_POST["designation"];
$q= "INSERT INTO `teacher`(`id`, `department`, `designation`) VALUES ('$id','$department','$designation')";
mysqli_query($conn,$q);
}
if($_POST["branch_code"] != "Branch code")
{
$branch_code=$_POST["branch_code"];
$sql= "INSERT INTO `student`(`id`, `branch_code`, `department`) VALUES ('$id','$branch_code','$department')";
mysqli_query($conn,$sql);
}
$query= "INSERT INTO `user`(`id`, `u_name`, `u_password`, `u_type`) VALUES ('$id','$u_name','$u_password','$u_type')";
if ($conn->query($query) === TRUE) {
echo "New record created successfully";
} else {
echo "Error: " . $query . "<br>" . $conn->error;
}
mysqli_close($conn);
?>