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
https://forums.phpfreaks.com/topic/159484-shopping-cart-getpost-problem/
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.

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.

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.