-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcreate.php
More file actions
67 lines (66 loc) · 2.89 KB
/
create.php
File metadata and controls
67 lines (66 loc) · 2.89 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
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
<?php
include "inc/header.php";
include "lib/config.php";
include "lib/Database.php";
?>
<?php
$db = new Database();
if (isset($_POST['submit'])) {
$name = mysqli_real_escape_string($db->link, $_POST['name']);
$email = mysqli_real_escape_string($db->link, $_POST['email']);
$skill = mysqli_real_escape_string($db->link, $_POST['skill']);
if ($name == "" || $email == "" || $skill == "") {
$error = "<div class='alert alert-danger'>Field must be Empty !.</div>";
} else {
$query = "INSERT INTO tbl_user(name, email, skill) Values('$name', '$email', '$skill')";
$create = $db->insert($query);
}
}
?>
<div class="row">
<div class="col-md-12">
<?php
if (isset($_GET['msg'])) {
echo $_GET['msg'];
}
?>
</div>
</div>
<div class="body-content" style="border:1px solid #ddd; margin-bottom:15px;">
<div class="row">
<div class="col-md-12">
<div class="panel-heading d-flex align-items-center justify-content-between">
<div style="width: 50%; display: inline-block;">
<h2 style="margin: 0;">Todo Create </h2>
<small>Todo list management Database</small>
</div>
<a class="btn btn-primary" style="float: right; display: inline-block; padding: 11px" href="index.php" class="text-right">Back</a>
</div>
<div class="panel-body">
<div style="width:60%; margin:0 auto;">
<?php
if (isset($error)) {
echo $error;
}
?>
<form action="create.php" method="POST">
<div class="form-group">
<label for="name">Name</label>
<input class="form-control" type="text" name="name" id="name" placeholder="Enter Name">
</div>
<div class="form-group">
<label for="email">Email</label>
<input class="form-control" type="email" name="email" id="email" placeholder="Enter Email">
</div>
<div class="form-group">
<label for="phone">Skill</label>
<input class="form-control" type="phone" name="skill" id="phone" placeholder="Enter Skill">
</div>
<div class="form-group">
<input class="btn btn-info" type="submit" name="submit" value="Create">
<a href="index.php" class="btn btn-info" type="reset" value="Cancel">Cancel</a>
</div>
</form>
</div>
</div>
<?php include "inc/footer.php" ?>