Jump to content

shopping cart get/post problem!


scentofindie

Recommended Posts

I am having an issue regarding a 'shopping cart'

 

1. Able to display column/row on page and added buy button to url.

//Issue Begins:

2a. The order form is supposed to get the ID, insteed is calling an ARRAY

 iaoprocess.php?action=add&id=Array

???

 

2b. also, (I assume due to the ID issue, the data is not being called from the database on the order form.

 

3. how do I include an

<input type=\"text\" name=\"$i_buy\" value=\"10\">

when the user selects quantity to purchase?

 

Thanks

J.

Link to comment
Share on other sites

Strange....

 

I managed to get the data into the page, but oddly, there are 2 array's echoing above it

???

Any ideas as to why.

 

 

I am having an issue regarding a 'shopping cart'

 

1. Able to display column/row on page and added buy button to url.

//Issue Begins:

2a. The order form is supposed to get the ID, instead is calling an ARRAY

 iaoprocess.php?action=add&id=Array

???

 

2b. also, (I assume due to the ID issue, the data is not being called from the database on the order form.

 

3. how do I include an

<input type=\"text\" name=\"$i_buy\" value=\"10\">

when the user selects quantity to purchase?

 

Thanks

J.

Link to comment
Share on other sites

Strange....

 

I managed to get the data into the page, but oddly, there are 2 array's echoing above it

???

Any ideas as to why.

Not without seeing your code. You should also tell use what is contained within these arrays and what you're trying to do.

Link to comment
Share on other sites

Hi

Thanx for responding.

right, so the code:

<?php

    $IAO_ID = $_GET[iAO_ID];
    $action     = $_GET[action];

    switch($action) {
     
        case "add": 
            $_SESSION['cart'][$IAO_ID]; //add one $IAO_ID
        break; 
    }    

    if($_SESSION['cart']) {
                  foreach($_SESSION['cart'] as $IAO_ID => $i_buy) {     
                 
                $sql = mysql_query("SELECT * FROM IAO WHERE IAO_ID = '$IAO_ID'");
                $sql = mysql_fetch_assoc($sql); 

                    
                    $i_buy = $i_buy['value'];          //units input as text
                    $i_sub = $i_buy * $PRICE ;      //cost
                    $i_fee = $i_sub * .10;	     //trade fee
                    $i_total = $i_fee + $i_sub;     //total

echo "<table width=\"400\" border=\"0\" cellspacing=\"2\" cellpadding=\"2\">";
echo "<tr><th width=\"200\" scope=\"row\"><div align=\"left\">IAO ID</div></th>";
echo "<td colspan=\"2\"><div align=\"left\">"; echo $sql['IAO_ID'];"</div></td></tr>";
echo "<tr><th width=\"200\" scope=\"row\"><div align=\"left\">PRODUCT</div></th>";
echo "<td colspan=\"2\"><div align=\"left\">"; echo $sql['PRODUCT'];"</div></td></tr>";
echo "<tr><th width=\"200\" scope=\"row\"><div align=\"left\">CATEGORY</div></th>";
echo "<td colspan=\"2\"><div align=\"left\">"; echo $sql['CATEGORY'];"</div></td></tr>";
echo "<tr><th width=\"200\" scope=\"row\"><div align=\"left\">GENRE</div></th>";
echo "<td colspan=\"2\"><div align=\"left\">"; echo $sql['GENRE'];"</div></td></tr>";
echo "<tr><th width=\"200\" scope=\"row\"><div align=\"left\">RATING</div></th>";
echo "<td colspan=\"2\"><div align=\"left\">"; echo $sql['RATING'];"</div></td></tr>";
echo "<tr><th width=\"200\" scope=\"row\"><div align=\"left\">PRICE</div></th>";
echo "<td colspan=\"2\"><div align=\"left\">"; echo $sql['PRICE'];"</div></td></tr>";
echo "<tr><th width=\"200\" scope=\"row\"><div align=\"left\">ARTIST</div></th>";
echo "<td colspan=\"2\"><div align=\"left\">"; echo $sql['ARTIST'];"</div></td></tr>";
echo "<tr><th width=\"200\" scope=\"row\"><div align=\"left\">TITLE</div></th>";
echo "<td colspan=\"2\"><div align=\"left\">"; echo $sql['TITLE'];"</div></td></tr>";
echo "<tr><th width=\"200\" scope=\"row\"><div align=\"left\">UNITS AVAILABLE</div></th>";
echo "<td colspan=\"2\"><div align=\"left\">"; echo $sql['UNITS'];"</div></td></tr>";
echo "<tr><th width=\"200\" scope=\"row\"><div align=\"left\">UNITS TO ORDER</div></th>";
echo "<td colspan=\"2\"><div align=\"left\"><input type=\"text\" name=\"$i_buy\" value=\"10\"></div></td></tr>";
echo "<tr><th width=\"200\" scope=\"row\"><div align=\"left\"></div></th>";
echo "<td colspan=\"2\"><div align=\"left\"></div></td></tr>";
echo "<tr><th width=\"200\" scope=\"row\"><div align=\"left\">SUB TOTAL</div></th>";
echo "<td colspan=\"2\"><div align=\"left\">"; echo $i_sub;"</div></td></tr>";
echo "<tr><th width=\"200\" scope=\"row\"><div align=\"left\">TRADE FEE</div></th>";
echo "<td colspan=\"2\"><div align=\"left\">"; echo $i_fee;"</div></td></tr>";
echo "<tr><th width=\"200\" scope=\"row\"><div align=\"left\">TOTAL</div></th>";
echo "<td colspan=\"2\"><div align=\"left\">"; echo $i_total;"</div></td></tr>";
echo "<tr><th width=\"200\" scope=\"row\"><div align=\"left\"></div></th>";
echo "<td colspan=\"2\"><div align=\"left\"></div></td></tr>";
echo "<tr><th width=\"200\" scope=\"row\"><div align=\"left\">PLACE ORDER</div></th>";
echo "<td colspan=\"2\"><div align=\"left\"><input type=\"button\" id=\"submit\" value=\"Place Order\"></div></td></tr>";
echo "</table>";
}
                     
                }
?>

 

 

Strange....

 

I managed to get the data into the page, but oddly, there are 2 array's echoing above it

???

Any ideas as to why.

Not without seeing your code. You should also tell use what is contained within these arrays and what you're trying to do.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.