if isset not working for undefined index, how to fix

This doesn’t seem to have anything to do with WordPress, but the problem is simple: You’re still using $_POST['quantity'] outside of isset().

You’re checking isset() here:

if(isset($_POST['quantity'])) {
$quantityinstock = $_POST['quantity'];
}

But then you’re immediately using it without the check anyway:

$quantityinstock = $dbConn->escape_string($_POST['quantity']);

You should not be using $_POST['quantity'] without a check for isset().

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)