-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathnewstock.php
52 lines (43 loc) · 1.29 KB
/
newstock.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
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="css/main.css">
<meta name="viewport" content="width=device-width, user-scalable=no" />
</head>
<body>
<div class="container">
<form id="contact" action="newstock.php" method="post">
<div class="bgimg"><h3 align="center">
<?php
$servername = "localhost";
$username = "id1362768_126ankush";
$password = "jaimatadi";
$dbname = "id1362768_cropstock";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sh = $_POST["sh"];
$crop = $_POST["crop"];
$fname = $_POST["fname"];
$qty = $_POST["qty"];
$hd = $_POST["hd"];
$ed = $_POST["ed"];
$sql = "INSERT INTO storagehouse(StorageHouse, Crop, Farmer, Quantity, HarvestDate, ExpiryDate)
VALUES ('$sh', '$crop' , '$fname', '$qty', '$hd', '$ed')";
if ($conn->query($sql) === TRUE) {
echo "New record created successfully";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
$conn->close();
?>
</h3>
</div>
</form>
</div>
<p id="container"> hello </p>
</body>
</html>