I have been making a small webshop site with php and mysql. It is working fine locally with xampp, but after uploading it to a server some of the pages doesn't display everything.
My site is built up with div tags for header, menu, centent and footer. When viewing the source from the server, I see that the html simply stops after the content opening tag. No content, close tag or footer. But this is only for 2 pages while the rest is working.
The only thing I changed before uploading was the connection to the database, but some of the working pages uses this without any problem.
Here is the code for the add_to_cart page which i not working.
<?php
$ID = $_POST['id'];
$amount = $_POST['amount'];
if (preg_match("/^[0-9]+$/", $amount) && $amount != 0) {
if (isset($_SESSION['cart'][$ID])) {
$_SESSION['cart'][$ID]['quantity'] += $amount;
} else {
$r = @mysqli_query ($dbc, "SELECT price FROM product WHERE product_ID=$ID");
$price = mysqli_fetch_array($r)['price'];
echo $price;
$_SESSION['cart'][$ID] = array('quantity' => $amount, 'price' => $price);
}
}
header("Location: products=$ID");
?>