-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadmin_entry.php
123 lines (110 loc) · 2.78 KB
/
admin_entry.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<?php
session_start();
include('connect.php');
if(isset($_POST['btnSave']))
{
$txtadminname=$_POST['txtadminname'];
$txtEmail=$_POST['txtEmail'];
$txtPassword=$_POST['txtPassword'];
$txtPhone=$_POST['txtPhone'];
$txtAddress=$_POST['txtAddress'];
//Image Upload-------------------------------------------------------
//$filecustomerphoto=$_FILES['filecustomerphoto']['name']; //Alex.jpg
//$FolderName="customerphoto/"; //CustomerPhoto/
//$FileName=$FolderName . '_' . $filecustomerphoto; //CustomerPhoto/_Alex.jpg
//$copied=copy($_FILES['filecustomerphoto']['tmp_name'], $FileName);
//if(!$copied)
//{
//echo "<p>Customer Photo Cannot Upload!</p>";
//exit();
//}
//Check Validation : Email Already exist-----------------------------
$Check="SELECT * FROM admin WHERE Email='$txtEmail' ";
$result=mysqli_query($connection,$Check);
$count=mysqli_num_rows($result);
if($count > 0)
{
echo "<script>window.alert('Email Address Already Exist!')</script>";
echo "<script>window.location='admin_entry.php'</script>";
}
else
{
$Insert="INSERT INTO admin
(adminname,Email,Password,Phone,Address)
VALUES
('$txtadminname','$txtEmail','$txtPassword','$txtPhone','$txtAddress')
";
$result=mysqli_query($connection,$Insert);
}
if($result)
{
echo "<script>window.alert('Successfully Saved!')</script>";
echo "<script>window.location='admin_entry.php'</script>";
}
else
{
echo "<p>Something went wrong in Admin Entry : " . mysqli_error($connection) . "</p>";
}
//------------------------------------------------------------------
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Admin Entry</title>
</head>
<body>
<form action="admin_entry.php" method="post" enctype="multipart/form-data">
<script>
$(document).ready
( function ()
{
$('#tableid').DataTable();
}
);
</script>
<fieldset>
<legend>Admin Entry :</legend>
<table cellpadding="5px" align="center">
<tr>
<td>Admin Name :</td>
<td>
<input type="text" name="txtadminname" placeholder="Eg. Alan Smith" required />
</td>
</tr>
<tr>
<td>Email :</td>
<td>
<input type="email" name="txtEmail" placeholder="[email protected]" required />
</td>
</tr>
<tr>
<td>Password :</td>
<td>
<input type="password" name="txtPassword" placeholder="XXXXXXXXXXXXXX" required />
</td>
</tr>
<tr>
<td>Phone :</td>
<td>
<input type="text" name="txtPhone" placeholder="+95-----------" required />
</td>
</tr>
<tr>
<td>Address :</td>
<td>
<textarea name="txtAddress" placeholder="Enter Address"></textarea>
</td>
</tr>
<tr>
<td></td>
<td>
<input type="submit" name="btnSave" value="Save" />
<input type="reset" name="btnClear" value="Clear" />
</td>
</tr>
</table>
<hr/>
</form>
</body>
</html>