Need some idea on how to store items from page2.php to the cart table?
<p>That's the code below, It will get the ids variable from the url coming from page1.php,</p>

<p><a href="http://www.stores.com/cart.php?action=add_item&amp;ids=1&amp;qty=1&amp;register=0&amp;id=4" rel="nofollow">http://www.stores.com/cart.php?action=add_item&amp;ids=1&amp;qty=1&amp;register=0&amp;id=4</a> </p>

<p>then it will either add, update or remove the item you can see the ids in each of the cases along witht he qty and id variable as well found int he url as below: then the script will develop the function AddItem, UpdateItem and RemoveItem. In each of those functions the scrip will either SELECT, UPDATE or DELETE from the database the info acourding to the existance of the id inside the database if I am not wrong. Then there is a big query below that will query the results in tables dkb and cdkb according to the id in the table cart If I am not wrong not clear on that. But the thing is that there is a second page call page2.php that has a slightly differences and it is the idc variable in it instead of ids. </p>

<p><a href="http://www.stores.com/cart.php?action=add_item&amp;idc=1&amp;qty=1&amp;register=0&amp;id=4" rel="nofollow">http://www.stores.com/cart.php?action=add_item&amp;idc=1&amp;qty=1&amp;register=0&amp;id=4</a> </p>

<p>I might be wrong on building these two url to signal the script to display the results coming from page1.php in a different way and display the results of page2.php in another way. </p>

<p>

<pre><code>    switch($_GET["action"])
     {
        case "add_item":
        {
         AddItem($_GET["ids"], $_GET["qty"]);
         ShowCart();
         break;
       }
        case "update_item":
        {
         UpdateItem($_GET["ids"], $_GET["qty"]);
         ShowCart();
         break;
        }
        case "remove_item":
        {
         RemoveItem($_GET["ids"], $_GET["id"]);
         ShowCart();
         break;
        }
        default:
        {
         ShowCart();
        }
    }
    function AddItem($itemId, $qty){

    $result = mysql_query("SELECT COUNT(*) FROM cart WHERE cookieId = '" . GetCartId() . "' AND id = $itemId");
      $row = mysql_fetch_row($result);
       $numRows = $row[0];

       if($numRows == 0)
      {
       // This item doesn't exist in the users cart,
       // we will add it with an insert query
        mysql_query("INSERT INTO cart(cookieId, id, qty) values('" . GetCartId() . "',   $itemId, $qty)");
       //printf ("Inserted records: %d\n", mysql_affected_rows());

       }
      else
       {
         // This item already exists in the users cart,
         // we will update it instead
         mysql_query("UPDATE cart SET qty = $qty WHERE cookieId = '" . GetCartId() . "' AND id = $itemId");

        }

    }

    function UpdateItem($itemId, $qty)
       {

        mysql_query("UPDATE cart SET qty = $qty WHERE cookieId = '" . GetCartId() . "' AND id = $itemId");
        //printf ("Updated records: %d\n", mysql_affected_rows());
       }

   function RemoveItem($itemId) 
      {

    mysql_query("DELETE FROM cart WHERE cookieId = '" . GetCartId() . "' AND id = $itemId");
    }

    ?&gt;

    &lt;?php 
   function ShowCart()

    {
    $result = mysql_query("SELECT
                  cart.id         cart_id,
                  cart.id         cart_id,
                  cart.cartId     cartId,
                  cart.cookieId   cookie_Id,
                  cart.qty        qt_y,                     
                  cdkb.id         cdkb_id,
                  cdkb.name       name,
                  cdkb.image      image,
                  cdkb.price      price,
                  dkb.id          dkb_id,
                  dkb.name        name1, 
                  dkb.image       image1,
                  dkb.price       price2,
                  dbl.product_id  product_id,
              dbl.price       price3,
              dbl.variety     variety,
              dbl.description description                  
    FROM
        cart


        LEFT OUTER JOIN cdkb
           ON cart.id = cdkb.id    

        LEFT OUTER JOIN dkb
           ON cart.id = dkb.id

        LEFT OUTER JOIN dbl
           ON dbl.id = dkb.id 


    WHERE
        cart.cookieId ='" . GetCartId() . "' ' ORDER BY cdkb.name AND dkb.name ASC");

    &lt;div id="cart"&gt;
&lt;div id="group"&gt;
&lt;div id="quantity"&gt;Qty&lt;/div&gt;
&lt;div id="cartpic"&gt;Pic&lt;/div&gt;
&lt;div id="product"&gt;Product&lt;/div&gt;
&lt;div id="cartprice"&gt;Price&lt;/div&gt;
&lt;div id="remove"&gt;Remove&lt;/div&gt;
&lt;/div&gt;
&lt;?php

$totalCost=0;
while($row = mysql_fetch_array($result))
  {  
   // Increment the total cost of all items
   $totalCost += ($row["qt_y"] * $row["price1"]);

 ?&gt;

   &lt;div id="cart1"&gt;
   &lt;select name="&lt;?php echo $row["ckb_id"];?&gt;" onChange="UpdateQty(this)"&gt;
  &lt;?php  print($row["ckb_id"]);?&gt;
  &lt;?php

   for($i = 1; $i &lt;= 30; $i++)
     {
      echo "&lt;option ";
       if($row["qt_y"] == $i)
         {
          echo " SELECTED ";
         }
        echo "&gt;" . $i . "&lt;/option&gt;";
      }
?&gt;
  &lt;/select&gt;
  &lt;/div&gt;
  &lt;div id="cart2"&gt;
  &lt;img src="images/logopic.gif"&lt;?php /*?&gt;&lt;?php echo $row["image1"]; ?&gt;&lt;?php */?&gt; alt="we" width="60" height="50" /&gt;
  &lt;/div&gt;
  &lt;div id="cart3"&gt;&lt;p&gt;&lt;?php echo $row["dishname1"]; ?&gt;&lt;/p&gt;&lt;/div&gt;
  &lt;div id="cart4"&gt;&lt;p&gt;
  $&lt;?php echo number_format($row["price3"], 2, ".", ","); ?&gt;&lt;/p&gt;&lt;/div&gt;

  &lt;div id="cart5"&gt;
  &lt;p&gt;&lt;?php
  printf('&lt;a href="cart.php?action=remove_item&amp;id=%d&amp;idc=%d&amp;register=%s"&gt;Remove&lt;/a&gt;',  $_GET['id'], $row['ckb_id'], $_GET['register']);
?&gt;&lt;/p&gt;&lt;/div&gt;

&lt;hr size="1" color="red" &gt;

&lt;script language="JavaScript"&gt;

function UpdateQty(item)
  {
   itemId = item.name;
   newQty = item.options[item.selectedIndex].text;

   document.location.href = 'cart.php?action=update_item&amp;id='+itemId+'&amp;qty='+newQty;
  }

&lt;/script&gt;

  &lt;?php
   }
   ?&gt;

   &lt;font face="verdana" size="2" color="black" style="clear:right;"&gt;
   &lt;b&gt;Total: $&lt;?php echo number_format($totalCost, 2, ".", ","); ?&gt;&lt;/b&gt;&lt;/font&gt;&lt;/td&gt;


   &lt;?php
    }
    ?&gt;
</code></pre>
