Why a blank page??

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I have a problen getting some information to display on my internet
store's web page.

Normally, to view the store's shopping cart the user
clicks the "View Cart" button. If there are any items in
the cart with his/her alloted cartId, those items are
displayed in a formatted display. It works fine (see 'does display'

If a user clicks the "Add to Cart" button displayed with
any product I want to display the cart immediately after the
product has been added.

However, the product item gets added to the cart OK, but the
"pageContentsCell" is blank. (see 'won't display' below).

Can anyone see where I'm going wrong???

$departmentId = null;
$categoryId = null;
$searchString = null;
$addProdId = null;
$cartId = getCartIdFromCookie();

// if adding a product to the cart
// make sure we have a valid cartId
if (isset($_GET['PId'])) {
    $addProdId = $_GET['PId'];
    if (!$cartId) {
        $cartId = getNewCartId();
} else {

 ..... other conditions ....


code and html for title, menus, etc


                    <td id="pageContentsCell">
// All code for the content area goes in here
if ($addProdId) {
    addItemToCart($cartId, $addProdId);
    displayShoppingCart($cartId); // <- won't display!!!
} else if (empty($_GET)) {
    // first page
} else if (isset($_GET['viewCart'])) {
    if ($cartId) {
        displayShoppingCart($cartId); <- does display!!!
    } else {
other conditions...


closing html


Re: Why a blank page??


Not sure why this is happening. You could add some debugging messages
to displayShoppingCart  or addItemToCart to see what might be going
on. Maybe it's exiting before that point or encountering an error?

I would set error_reporting(E_ALL) if necessary to check if there's
some unexpected conditions.

Site Timeline