-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
delvery_address_action.php
65 lines (41 loc) · 1.37 KB
/
delvery_address_action.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
55
56
57
58
59
60
61
62
63
64
65
<?php
session_start();
$mail=$_SESSION['alogin'];
$con=mysqli_connect("localhost","root","","organic_shop_db")or die ("Couldn't connect");
if(isset($_POST["address"]))
{
$fname=$_POST["fname"];
$mob=$_POST["mob"];
$address_line=$_POST["address_line"];
$landmark=$_POST["landmark"];
$town=$_POST["town"];
$pincode=$_POST["pincode"];
$atype=$_POST["atype"];
$status5='VALID';
$del_adrs="SELECT * FROM `tbl_customer_delv_address` WHERE address_line='$address_line' and fname='$fname' and status5='VALID'";
$d_del_adrs=mysqli_query($con,$del_adrs);
//$row=mysqli_fetch_array($d_del_adrs);
$rowcount = mysqli_num_rows($d_del_adrs);
if($rowcount==0)
{
$sql=mysqli_query($con," INSERT INTO `tbl_customer_delv_address`( `email`,`fname`,`Mobile number`, `address_line`, `landmark`, `town_city`, `pin_code`, `address_type`, `status5`) VALUES ('$mail','$fname','$mob','$address_line','$landmark','$town','$pincode','$atype','$status5') ");
if($sql){
echo "<script>
window.location='checkout.php';
</script>";
//header("Location:add_seller_prod.php");
}
else{
echo "<script> alert('Failed to add address! try again');
window.location='checkout.php';
</script>";
}
}
else
{
echo "<script> alert('Address already added ');
window.location='checkout.php';
</script>";
}
}
?>