-
Notifications
You must be signed in to change notification settings - Fork 2
/
Ship_back.php
54 lines (46 loc) · 1.42 KB
/
Ship_back.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
53
54
<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "aga_courier";
$email = $_POST['email'];
$pin = $_POST['pin'];
$first_name=$_POST['first_name'];
$last_name=$_POST['last_name'];
$contact=$_POST['contact'];
$address=$_POST['address'];
$address_1=$_POST['address_1'];
$city=$_POST['city'];
$country=$_POST['country'];
$package_weight=$_POST['package_weight'];
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "INSERT INTO ship_details (first_name,last_name,contact, email, address, address_1, city, pin, country, package_weight)
VALUES ('$first_name','$last_name','$contact','$email','$address','$address_1','$city','$pin','$country','$package_weight')";
if($package_weight<0){
echo "<script>
alert('Error! package_weight is negative');
window.location.href='ship.html';
</script>";
}
$sql = "SELECT * FROM ship_details WHERE email = '".$_SESSION['ema']."'";
$result = mysqli_query($conn, $sql);
$resultCheck = mysqli_num_rows($result);
if($resultCheck > 0){
echo "<script>
alert('Thank you');
window.location.href='order_summary.php';
</script>";
}
else {
echo "<script>
alert('Email is not registered');
window.location.href='ship.html';
</script>";
}
$conn->close();
?>