Can anybody help me? I perform my shop cart using php and in some moment after several customizations my header() function stopped working. I just can not figure why. I appreciate any help.
$page = 'index.php';
if (isset($_GET['add'])) {
$con = mysqli_connect("localhost", "noivaem", "password", "noivaem") or die (mysqli_error());
$quantity = mysqli_query($con, "SELECT id, quantity FROM Products WHERE id=".mysqli_real_escape_string($con, $_GET['add']));
while($quantity_row = mysqli_fetch_assoc ($quantity)) {
$_SESSION['cart_'.(int)$_GET['add']]+=1;}
header('Location: '.$page); }
Check to ensure nothing is being output to the browser before header()
Hint: You have an error in your code.
After several hours reserching my code, finally I founded what was causing the Header inoperative. There was a specific jquery script avoiding the header to work properly. I removed the jquery script line and know it works fine. My page was disconfigured but I only need to recofingure in a manual way. Thank you for your help anyway. Best regards, Roberto