Initial commit
This commit is contained in:
23
indexes/process/modify/item_modify.php
Normal file
23
indexes/process/modify/item_modify.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
include "../../ConnectDB.php";
|
||||
session_start();
|
||||
$username = mysqli_real_escape_string($conn, $_SESSION['username']);
|
||||
$usertype = mysqli_real_escape_string($conn, $_SESSION['user_type']);
|
||||
|
||||
if(isset($_GET["name"], $_GET["quantity"])) {
|
||||
$name = $_GET["name"];
|
||||
$quantity = $_GET["quantity"];
|
||||
|
||||
if(($usertype == "seller" && $quantity >= 0 && $quantity <= 100) || ($usertype == "buyer" && $quantity >= 0)){
|
||||
$add = "UPDATE $usertype SET $name = $quantity WHERE name='$username'";
|
||||
$res = mysqli_query($conn, $add);
|
||||
}
|
||||
else{
|
||||
echo "<script type='text/javascript'>
|
||||
alert('Please input a valid amount of fruit!');
|
||||
</script>";
|
||||
}
|
||||
}
|
||||
header('Location: ../cart_index.php');
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user