Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6721831
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:22:32+00:00 2026-05-26T09:22:32+00:00

I have been working on this for a few days. I never messed with

  • 0

I have been working on this for a few days. I never messed with anything to do with a cart so I am trying to understand this. Here is my web page and if you look off to the side it is not doing what I need it to do and also showing other codes: http://www.elinkswap.com/snorris/header.html. What I am trying to get done is when you are on the header.html page and you look at the cart content it should say You have 0 items. Then say you go over to the items and you want 1 and click update it should say you have 1 item in your cart. But for some reason I can not get it to work right. Here is a little bit of the code I am working with:

<?php # Script 5.2 - header.html

/*
*   This page begins the HTML header for the site.
*   The header also creates the right-hand column.
*   This page calls session_start().
*/

// Need sessions!
session_start();

// Check for a $page_title value:
if (!isset($page_title)) $page_title = 'WoW::World of Widgets!';
?><!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <title><?php echo $page_title; ?></title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <link href="./includes/style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="all">

    <div class="box">
        <div class="menu"><a href="#">home</a><a href="#">about</a><a href="#">products</a><a href="#">contact</a></div>
        <div class="header"><img alt="" style="float:right; " src="./images/www.jpg" width="225" height="95" />
        <h1>[<span class="style1">WoW</span>] World of Widgets</h1>
        <div class="clearfix"></div>
    </div>

    <div class="newsbar">
        <h1>Browse Widget Categories</h1>
        <div class="p2"><ul>
<li><a href="category.php?cid=5">Fuzzy Widgets</a></li>
<li><a href="category.php?cid=4">Non-widget Widgets</a></li>
<li><a href="category.php?cid=6">Razor-sharp Widgets</a></li>
<li><a href="category.php?cid=2">Widgets That Bounce</a></li>
<li><a href="category.php?cid=3">Widgets That Sit There</a></li>
<li><a href="category.php?cid=1">Widgets That Wiggle</a></li>
<?php
// Get all the categories and
// link them to category.php.

// Define and execute the query:
$q = 'SELECT category_id, category FROM categories ORDER BY category';
$r = mysqli_query($dbc, $q);

// Fetch the results:
while (list($fcid, $fcat) = mysqli_fetch_array($r, MYSQLI_NUM)) {

    // Print as a list item.
    echo "<li><a href=\"category.php?cid=$fcid\"></a></li>\n";

    if($_SERVER['PHP_SELF']!="CART FILE"){
                echo "<h1>Cart Contents</h1>";
                echo "<div class=\"p2\">";
                $itemCount=$k;
                foreach($_SESSION['cart'] as $k=>$v){

                    for($i=0;$i<count(X);$i++){
                        $itemCount+=X;
                      }

                }
                echo "<a href=\"cart.php\">You have ".$itemCount." total items in your cart.</a>";
                echo "</div>\n";


} // End of while loop.

        ?></ul></div>


        <h1>Specials?</h1>
        <div class="p2">
            <p>Maybe place specials or new items or related items here.</p>
        </div>

    </div>

    <div class="content">

I am still learning some of these things and some of this just doesnt make sense and I cant get it to work. Thanks for looking

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T09:22:33+00:00Added an answer on May 26, 2026 at 9:22 am

    You can count an array object, by just using count();

    There is no need to loop over the array incrementing a $itemCount variable.

    Just have:

    $itemCount = count( $myShoppingCart );

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I have been working on this for a few days now, and I
I have been working on this issue for a few days now and can't
I have been working on this frustrating bug for a few days now and
I have been working on this for a few days with no luck... I
I have been working on this for a few days and this is doing
Morning, I have been working on this problem for a few days and cannot
I have been working on this for a few days now and I have
I have been working on this project for a few days, it’s a C#
I have been trying for a few days to get Sonata Media Bundle working
I have been working on this for few hours and got stuck, so how

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.