Why is $if (isset($_GET['edit']) returning empty value when it's inside if (isset($_POST['add_submit']) but it's returning the value that I want When it's not inside if (isset($_POST['add_submit']) and how to fix it. Thank you.
if (isset($_POST['submit']) ) {
$brand = $_POST['brand']);
if (isset($_GET['edit']) ) {
$sql = "UPDATE brand SET brand = '$brand' WHERE Bra_ID = '29'";
$stmt = $con->prepare($sql);
$stmt->execute();
header("Location: brands.php");
exit();
}
$sql = "INSERT INTO brand(brand) VALUES('$brand')";
$stmt = $con->prepare($sql);
$stmt->execute();
header("Location: brands.php");
exit();
}