scentofindie Posted May 24, 2009 Share Posted May 24, 2009 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. Quote Link to comment Share on other sites More sharing options...
scentofindie Posted May 24, 2009 Author Share Posted May 24, 2009 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. Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted May 24, 2009 Share Posted May 24, 2009 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. Quote Link to comment Share on other sites More sharing options...
scentofindie Posted May 24, 2009 Author Share Posted May 24, 2009 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. Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted May 24, 2009 Share Posted May 24, 2009 I see nothing wrong with that code. Whats is the actual problem you're having? I am not understanding you Quote Link to comment Share on other sites More sharing options...
scentofindie Posted May 24, 2009 Author Share Posted May 24, 2009 It is displaying 3 forms on the page instead of 1. Ironically the last is showing the data, the previous 2 are not. Quote Link to comment Share on other sites More sharing options...
scentofindie Posted May 24, 2009 Author Share Posted May 24, 2009 grrrr. now i am back to square one. it won't display the data. same code. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.