-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinsert.php
82 lines (54 loc) · 1.79 KB
/
insert.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
<?php
include_once('database/connection.php');
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$name = $_POST['name'];
$roll = $_POST['roll'];
$reg = $_POST['reg'];
$age = $_POST['age'];
$sql = "INSERT INTO students VALUES(NULL, $name, $roll, $reg, $age)";
$result = $database->query($sql);
// if ( $result) {
// echo "This Name = Successfully";
// } else{
// echo "Unsuccessfull";
// }
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title> Students </title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
</head>
<body>
<div class="container">
<div class="row clearfix">
<div class="col-md-3"></div>
<div class="col-md-6">
<h1> Add new student </h1>
<a href="index.php" class="btn btn-primary">Student List Page</a>
<form method="POST" action="store.php">
<div class="form-group">
<label for="name">Name</label>
<input type="text" class="form-control" name="name" placeholder="Enter Name">
</div>
<div class="form-group">
<label for="roll">Roll</label>
<input type="number" class="form-control" name="roll" placeholder="Enter Roll">
</div>
<div class="form-group">
<label for="roll">Reg</label>
<input type="number" class="form-control" name="reg" placeholder="Enter reg">
</div>
<div class="form-group">
<label for="roll">Date of Birth</label>
<input type="date" class="form-control" name="age" placeholder="Enter Date of Birth">
</div>
<button type="submit" name='submit' class="btn btn-primary">Submit</button>
</form>
</div>
</div>
</div>
</body>
</html>