-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsave-staff.php
More file actions
42 lines (41 loc) · 1 KB
/
save-staff.php
File metadata and controls
42 lines (41 loc) · 1 KB
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
36
37
38
39
40
41
42
<?php
session_start();
error_reporting(0);
include('includes/config.php');
if(strlen($_SESSION['alogin'])=="")
{
header("Location: index.php");
}
else{
if(isset($_POST['submit']))
{
$staffname=$_POST['fullanme'];
$staffid=$_POST['staffid'];
$email=$_POST['email'];
$subject=$_POST['subject'];
$role=2;
$password="123456";
$sql="INSERT INTO admin(UserName,StaffID,email,SubjectId,Password,role) VALUES(:staffname,:staffid,:email,:subject,:password,:role)";
$query = $dbh->prepare($sql);
$query->bindParam(':stafftname',$staffname,PDO::PARAM_STR);
$query->bindParam(':staffid',$staffid,PDO::PARAM_STR);
$query->bindParam(':email',$email,PDO::PARAM_STR);
$query->bindParam(':subject',$subject,PDO::PARAM_STR);
$query->bindParam(':password',$password,PDO::PARAM_STR);
$query->bindParam(':role',$role,PDO::PARAM_STR);
$query->execute();
$lastInsertId = $dbh->lastInsertId();
if($lastInsertId)
{
echo "Saved";
}
else
{
echo "Something went wrong. Please try again";
}
}
else{
echo "No submit";
}
}
?>