-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsubmit.php
More file actions
46 lines (41 loc) · 1.61 KB
/
submit.php
File metadata and controls
46 lines (41 loc) · 1.61 KB
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
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title> Submit Page </title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<?php header('Location: view.php');
?>
<p> Welcome Housemate! Here you can view items you and your fellow housemates have bought for you lovely home. Enjoy!</p>
<form action ="view.php" method="post">
<input type="text" placeholder="Household Name" name="HouseName">
<input type="text" placeholder="Number of Housemates" name="NumPeople">
<input type="text" placeholder="Your name" name="NameOfBuyer">
<input type="text" placeholder="Item name" name="NameOfItem">
<input type="number" placeholder="Item Price" name="ItemPrice">
<input type="number" placeholder="Number of items" name="QuantityItem">
<input type="date" placeholder="Date purchased" name="Date">
<input type="submit">
</form>
<!--<form action="view.php" method="post">
Household Name: <input type="text" name="housename">
<br />
Household ID: <input type="text" name="houseid">
<br />
Number of People: <input type="text" name="numpeople">
<br />
Password: <input type="text" name="password">
<br />
<input type="submit">
</form>-->
<?php
// Code to submit insert data into respective
$sql="INSERT INTO householditems (HouseholdName, NumberOfPeople, NameOfBuyer, NameOfItem, ItemPrice, QuantityOfItem, Date)
VALUES ('".$_POST['HouseName']."','".$_POST['NumPeople']."','".$_POST['NameOfBuyer']."','".$_POST['NameOfItem']."','".$_POST['ItemPrice']."','".$_POST['QuantityItem']."','".$_POST['Date']."')";
mysqli_query($con, $sql);
$result = mysqli_query($con,"SELECT * FROM householditems");
?>
</body>
</html>