userInfo update system is done

This commit is contained in:
CodeServer 2021-08-03 15:07:46 +01:00
parent 5d8f633fcc
commit 9a8cd9b3fc
7 changed files with 40 additions and 11 deletions

View File

@ -58,4 +58,19 @@
mysqli_stmt_close($stmt);
return $error;
}
function query_getUserInfo($conn, $uid) {
$sql = "Select * From userInfo Where C_ID= ? ";
$stmt = mysqli_stmt_init($conn);
if (!mysqli_stmt_prepare($stmt, $sql)) {
return null;
}
mysqli_stmt_bind_param($stmt, "s", $uid);
mysqli_stmt_execute($stmt);
$resultData = mysqli_stmt_get_result($stmt);
mysqli_stmt_close($stmt);
return $resultData;
}
?>

View File

@ -44,7 +44,7 @@
<div class="row">
<div class="col-sm-12" id="shopping_cart">
<form action="userInfo.php" method="get">
<form action="cart.php" method="get">
<table class="cartTable">
<thead>
<!-- <tr style="margin:auto; border: 2px solid black;">

0
shopping/checkout.php Normal file
View File

View File

@ -2,8 +2,11 @@
<html lang="en">
<?php
require_once '../php/connection.php';
require_once '../php/functions.php';
$conn = connectMysql();
require_once '../php/logged_in_header.php';
$resultData = query_getUserInfo($conn, $_SESSION['username']);
$row = $resultData->fetch_assoc();
?>
<head>
<!-- Required meta tags -->
@ -41,34 +44,34 @@
<form class="row g-3" action="../php/saveUserInfo.php" method="post">
<div class="col-md-6">
<label for="inputEmail4" class="form-label">Email</label>
<input type="email" class="form-control" name="email" id="inputEmail">
<input type="email" class="form-control" name="email" id="inputEmail" value="<?php echo $row["C_EMAIL"]?>">
</div>
<div class="col-md-6">
<label for="inputPhone4" class="form-label">Phone</label>
<input type="tel" class="form-control" name="phone" id="inputPhone" placeholder="123-456-7890" maxlength="12">
<input type="tel" class="form-control" name="phone" id="inputPhone" placeholder="123-456-7890" maxlength="12" value="<?php echo $row["C_PHONE"]?>">
</div>
<div class="col-12">
<label for="inputAddress" class="form-label">Address</label>
<input type="text" class="form-control" name="address" id="inputAddress" placeholder="1234 Main St">
<input type="text" class="form-control" name="address" id="inputAddress" placeholder="1234 Main St" value="<?php echo $row["C_ADDRESS"]?>">
</div>
<div class="col-12">
<label for="inputAddress2" class="form-label"></label>
<input type="text" class="form-control" name="unit" id="inputAddress2" placeholder="Apartment, studio, or floor">
<input type="text" class="form-control" name="unit" id="inputAddress2" placeholder="Apartment, studio, or floor" value="<?php echo $row["C_UNIT"]?>">
</div>
<div class="col-md-6">
<label for="inputCity" class="form-label">City</label>
<input type="text" class="form-control" name="city" id="inputCity">
<input type="text" class="form-control" name="city" id="inputCity" value="<?php echo $row["C_CITY"]?>">
</div>
<div class="col-md-4">
<label for="inputState" class="form-label">State</label>
<select id="inputState" class="form-select" name="country">
<option selected>Choose...</option>
<option>...</option>
<option <?php if ($row["C_COUNTRY"] === '') echo 'selected'; ?> >Choose...</option>
<option <?php if ($row["C_COUNTRY"] === 'Canada') echo 'selected'; ?> >Canada</option>
</select>
</div>
<div class="col-md-2">
<label for="inputZip" class="form-label">Zip</label>
<input type="text" class="form-control" name="zip" id="inputZip">
<input type="text" class="form-control" name="zip" id="inputZip" value="<?php echo $row["C_ZIP"]?>">
</div>
<div class="col-12">
<div class="form-check">
@ -84,6 +87,10 @@
if($_GET['error'] === "notChecked") {
echo '<div class="errorFont">Please check the box!</div>';
}
if($_GET['error'] === '0') {
echo '<div class="successFont">Updated Successfully!</div>';
}
?>
</div>
</form>

View File

@ -28,3 +28,6 @@ video
.errorFont
color: red
.successFont
color: green

View File

@ -35,6 +35,10 @@ video {
color: red;
}
.successFont {
color: green;
}
.index-page {
background-color: #edeae8;
}

File diff suppressed because one or more lines are too long