Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
113 lines (87 sloc) 4.33 KB
<?php
require("../dbCon.php");
if (!empty($_POST)) {
$query = "UPDATE customers SET CompanyName=?, ContactName=?, ContactTitle=?, Address=?, City=?, Region=?, Country=?, Phone=?, Fax=?
WHERE CustomerID = '" . $_SESSION["CustomerID"] . "'";
$stmt = $con->prepare($query);
$stmt ->bind_param("sssssssss", $_POST['CompanyName'], $_POST['ContactName'], $_POST['ContactTitle'],
$_POST['Address'], $_POST['City'], $_POST['Region'], $_POST['Country'], $_POST['Phone'], $_POST['Fax']);
$stmt ->execute();
}
//echo "Welcome " . $_SESSION["userName"] . "!";
$sql = "SELECT * FROM customers WHERE CustomerID = '" . $_SESSION["CustomerID"] . "'";
//echo $sql;
if (!$result = $con->query($sql)) {}
$row = $result->fetch_assoc();
if ($row) {
$CompanyName = $row['CompanyName'];
$ContactName = $row['ContactName'];
$ContactTitle = $row['ContactTitle'];
$Address = $row['Address'];
$City = $row['City'];
$Region = $row['Region'];
$PostalCode = $row['PostalCode'];
$Country = $row['Country'];
$Phone = $row['Phone'];
$Fax = $row['Fax'];
}
?>
<html>
<link rel="stylesheet" href="../style.css">
<body>
<div id="header">
<ul id="menu" class="blue">
<li><a href="cDashboard.php">Home</a></li>
<li class="active"><a href="cEditProfile.php">Edit Profile</a></li>
<li><a href="cSearchProduct.php">Search Product</a></li>
<li><a href="cCreateOrder.php">Create Order</a></li>
<li><a href="cPayment.php">Payment</a></li>
<li><a href="cCart.php">Cart</a></li>
<li><a href="cPastOrders.php">Past Orders</a></li>
<li class='fRight'><a href="logout.php">Log Out</a></li>
</ul>
</div>
<div id='contentwrapper'>
<h1>
<?php
echo "Editing profile for user '" . $_SESSION["CustomerID"] . "' (" . $ContactName . ")";
?>
</h1>
<form action="cEditProfile.php" method="post">
<div class="form-group">
<label>Company Name</label>
<input type="text" name="CompanyName" id="CompanyName"
value="<?php echo $CompanyName; ?>">
<label>Customer Name</label>
<input type="text" name="ContactName" id="ContactName"
value="<?php echo $ContactName; ?>">
<label>Contact Title</label>
<input type="text" name="ContactTitle" id="ContactTitle"
value="<?php echo $ContactTitle; ?>">
<label>Address</label>
<input type="text" name="Address" id="Address"
value="<?php echo $Address; ?>">
<label>City</label>
<input type="text" name="City" id="City"
value="<?php echo $City; ?>">
<label>Region</label>
<input type="text" name="Region" id="Region"
value="<?php echo $Region; ?>">
<label>Postal Code</label>
<input type="text" name="PostalCode" id="PostalCode"
value="<?php echo $PostalCode; ?>">
<label>Country</label>
<input type="text" name="Country" id="Country"
value="<?php echo $Country; ?>">
<label>Phone</label>
<input type="text" name="Phone" id="Phone"
value="<?php echo $Phone; ?>">
<label>Fax</label>
<input type="text" name="Fax" id="Fax"
value="<?php echo $Fax; ?>">
<input type="submit" id="submit" value="Submit">
</div>
</form>
</div>
</body>
</html>
You can’t perform that action at this time.