-
Notifications
You must be signed in to change notification settings - Fork 0
/
doupdateshipping.php
37 lines (33 loc) · 1.08 KB
/
doupdateshipping.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
<?php
//Use session object
session_start();
$addressID = $_POST["SAddressID"];
$name=$_POST["Sname"];
$address1=$_POST["Saddress1"];
$address2=$_POST["Saddress2"];
$city=$_POST["Scity"];
$state=$_POST["Sstate"];
$zip=$_POST["Szip"];
if($addressID==""||$name==""||$address1==""||$address2==""||$city==""||$state==""||$zip=="")
{
$_SESSION["errorMessage"]="You must enter a value for all boxes!";
header("Location:updateshipping.php?id=$addressID");
exit;
}
if(!is_numeric($zip))
{
$_SESSION["errorMessage"]="You must enter numbers for zip code!";
header("Location:updateshipping.php?id=$addressID");
exit;
}
else
{
$_SESSION["errorMessage"]="You have successfully updated the address!";
}
include("includes/openDbConn.php");
$sql="UPDATE shippingaddress SET Name='".$name."', Address1='".$address1."', Address2='".$address2."', City='".$city."', State='".$state."', Zip='".$zip."' WHERE AddressID='".$addressID."'";
//echo $sql;
$result=mysqli_query($db,$sql);
include("includes/closeDbConn.php");
header("Location:shipping.php");
?>