-
Notifications
You must be signed in to change notification settings - Fork 1
/
add_employee.php
44 lines (39 loc) · 1000 Bytes
/
add_employee.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
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
$conn = mysql_connect('localhost', 'root', '');
if (!$conn)
{
die("Database Connection Failed" . mysql_error());
}
$select_db = mysql_select_db('payroll');
if (!$select_db)
{
die("Database Selection Failed" . mysql_error());
}
if(isset($_POST['submit'])!="")
{
$lname = $_POST['lname'];
$fname = $_POST['fname'];
$gender = $_POST['gender'];
$type = $_POST['emp_type'];
$division = $_POST['division'];
$sql = mysql_query("INSERT into employee(lname, fname, gender, emp_type, division)VALUES('$lname','$fname','$gender', '$type', '$division')");
if($sql)
{
?>
<script>
alert('Employee had been successfully added.');
window.location.href='home_employee.php?page=emp_list';
</script>
<?php
}
else
{
?>
<script>
alert('Invalid.');
window.location.href='index.php';
</script>
<?php
}
}
?>