-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinsert.php
More file actions
30 lines (23 loc) · 901 Bytes
/
insert.php
File metadata and controls
30 lines (23 loc) · 901 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
<?php
$server = "localhost";
$username = "root";
$password = "";
$dbname = "insert";
$conn = mysqli_connect($server, $username, $password, $dbname);
if(isset($_POST['submit'])){
if(!empty($_POST['nitrogen']) && !empty($_POST['phosphorus'])&& !empty($_POST['potassium']) && !empty($_POST['moisture'])&& !empty($_POST['time'])){
$nitrogen = $_POST['nitrogen'];
$phosphorus = $_POST['phosphorus'];
$potassium = $_POST['potassium'];
$moisture = $_POST['moisture'];
$time = $_POST['time'];
$query = "insert into form(nitrogen,phosphorus,potassium,moisture,time) values('$nitrgoen', '$phosphorus', '$potassium', '$moisture', '$time')";
$run = mysqli_query($conn,$query) or die(mysqli_error());
if($run){
echo "form submitted successfully";
}
else{
echo "form not submitted";
}
}
}