-
Notifications
You must be signed in to change notification settings - Fork 4
/
insertparcel.php
30 lines (24 loc) · 894 Bytes
/
insertparcel.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
<?php
require 'connect.php';
$name = $_POST['customer_Name'];
$pickup_address = $_POST['pickup_address'];
$delivery_address = $_POST['delivery_address'];
$package_type = $_POST['package_type'];
$contact_no = $_POST['contact_no'];
$state_address = $_POST['state_address'];
$note = $_POST['note'];
$sql = "SELECT `id` FROM `customer` WHERE `username` = '$name'";
$result = $con->query($sql);
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
$realID = $row["id"];
}
$insert = "INSERT INTO parcel (customer_id, pickup_address, delivery_address, package_type, contact_no, state_address, note)
VALUES ('$realID', '$pickup_address', '$delivery_address', '$package_type', '$contact_no', '$state_address', '$note')";
mysqli_query($con, $insert);
echo "New record created successfully";
}
else {
echo "Error: " . $sql . "<br>" . mysqli_error($con);
}
?>