-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathinsert.php
More file actions
executable file
·40 lines (39 loc) · 856 Bytes
/
insert.php
File metadata and controls
executable file
·40 lines (39 loc) · 856 Bytes
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('config.php'); ?>
<h1>Insert New</h1>
<table>
<form method="post">
<tr>
<td>Test Name</td>
<td><input type="text" name="testname"></td>
</tr>
<tr>
<td>Test Fee</td>
<td><input type="number" name="testfee"></td>
</tr>
<tr>
<td><input type="submit" name="btn" value="Insert"></td>
</tr>
</form>
</table>
<?php
if(isset($_POST['btn'])) {
$testname = $_POST['testname'];
$testfee = $_POST['testfee'];
$res = mysqli_query($con,"INSERT INTO test (test_name,test_cost) VALUES ('$testname','$testfee')");
if($res==1) {
?>
<script>
alert ("Insertion Sucesssful");
window.location.href="update.php";
</script>
<?php
} else {
?>
<script>
alert ("Insertion Unucesssful");
window.location.href="update.php";
</script>
<?php
}
}
?>