-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadd.php
40 lines (36 loc) · 1.3 KB
/
add.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
<?php include 'header.php'; ?>
<div id="main-content">
<h2>Add New Record</h2>
<form class="post-form" action="savedata.php" method="post">
<div class="form-group">
<label>Name</label>
<input type="text" name="sname" />
</div>
<div class="form-group">
<label>Address</label>
<input type="text" name="saddress" />
</div>
<div class="form-group">
<label>Class</label>
<select name="class">
<option value="" selected disabled>Select Class</option>
<?php
$connection = mysqli_connect("localhost", "root", "", "crud") or die("Couldn't connect'");
$sql_query = "SELECT * FROM studentclass";
$result = mysqli_query($connection, $sql_query) or die("Failed");
while ($row = mysqli_fetch_assoc($result)) {
?>
<option value="<?php echo $row['cid'] ?>"><?php echo $row['cname'] ?></option>
<?php } ?>
</select>
</div>
<div class="form-group">
<label>Phone</label>
<input type="text" name="sphone" />
</div>
<input class="submit" type="submit" value="Save" />
</form>
</div>
</div>
</body>
</html>