callisto11
Members-
Posts
22 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Not Telling
callisto11's Achievements
Newbie (1/5)
0
Reputation
-
Hi everyone, Im finding it hard to make this form work (i've hightlight out the problem in green) what I want is, for a user to be able to update the quantity field of the item they insert into the shopping. So once they have inserted the new amount, they should be able to press update quantity button and it changes it. Thank you Calliso (Im very new to php ) <form action="update_item" method="get"> <input type="hidden" name="action" value="update_item" /> <table width="40%" border="1" bordercolor="black" bgcolor=""> <tr> <th width="5%"> <span class="style7">STYLE NUMBER</span></th> <th width="6%"> <span class="style7">DETAILS</span></th> <th width="6%"> <span class="style8">QUANTITY</span></th> <th width="7%"> <span class="style8">SIZE </span></th> <th width="7%"> <span class="style8">PRICE (per cartoon) </span></th> <th width="8%"> -</th> <?php foreach ($_SESSION['cart'] as $key => $general_cartoon) { ?> </tr> <tr> <td><span class="style19"><?php echo $_SESSION['cart'][$key] ['cartoon_id']; ?></span></td> <td><span class="style19"><?php echo $_SESSION['cart'][$key] ['title']; ?></span></td> <td><input type="text" size="2" name="quantity" value="<?php echo $_SESSION['cart'][$key] ['quantity']; ?>"/></td> <td><span class="style19"><?php echo $_SESSION['cart'][$key] ['size'];?></span></td> <td><span class="style19"><?php echo $_SESSION['cart'][$key] ['fee'];?></span></td> <?php $quantity =$_SESSION['cart'][$key]['quantity'];?> <td><a href="removefromcart.php?cartoon_id=<?php echo $_SESSION['cart'][$key]['cartoon_id'];?>&location=<?php echo $_SERVER['PHP_SELF'];?>">[REMOVE]</a></td> </tr> <?php }?> </table> <p> <?php } else { ?> No cartoon chosen yet <?php } ?> </p> <p> </p> <input name="update" type="submit" value="UPDATE QUANTITIES" title=" Updates the quantities of cartoons in the shopping cart"/> </form>
-
Hi everyone ???, Im very new to php and mysql and this is my first ever demo website that Im building. To keep the long story short, what I really need help with is that below is a copy of my shopping cart script, I want my user to able to change the quantity of the product that they have added to the shopping cart once they look into their shopping cart. I dont mind if a example can be shown, so that I can understand how Im surpose to create or add the code to my shopping cart code. Thank you Callisto11 My shopping cart code: <?php session_start(); //at the top of all pages. sessions it stores the data about the user in the web server. //the session stores session variables for each user,when a session is started the client //is given a session identifier if (isset($_SESSION['cart'])) { ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title></title> <link rel="stylesheet" type="text/css" href="style.css" /> <style type="text/css"> <!-- .style1 {color: #000000} .style7 { font-size: 12px; color: #000000; } .style8 { font-size: 12px; font-weight: bold; color: #000000; } .style12 { font-size: 14px; color: #000000; } .style19 {font-size: 14px; color: #000000; font-weight: bold; } --> </style> </head> <body> <div id="top_menu"></div> <div id="main_content"> <div id="top_banner"> <a href="index.html"><img src="images/roar.jpg" width="391" height="130" alt="home" title="logo" border="0" class="logo" /></a> </div> <div > <div class="title style1"> <p><strong>Shopping Cart</strong></p> </div> <div class="content_text"> <table width="40%" border="1" bordercolor="black" bgcolor=""> <tr> <th width="5%"> <span class="style7">STYLE NUMBER</span></th> <th width="6%"> <span class="style7">DETAILS</span></th> <th width="6%"> <span class="style8">QUANTITY</span></th> <th width="7%"> <span class="style8">SIZE </span></th> <th width="7%"> <span class="style8">PRICE (per cartoon) </span></th> <th width="8%"> -</th> <?php foreach ($_SESSION['cart'] as $key => $general_cartoon) { ?> </tr> <tr> <td><span class="style19"><?php echo $_SESSION['cart'][$key] ['cartoon_id']; ?></span></td> <td><span class="style19"><?php echo $_SESSION['cart'][$key] ['title']; ?></span></td> <td><span class="style19"><?php echo $_SESSION['cart'][$key] ['quantity'];?></span></td> <td><span class="style19"><?php echo $_SESSION['cart'][$key] ['size'];?></span></td> <td><span class="style19"><?php echo $_SESSION['cart'][$key] ['fee'];?></span></td> <?php $quantity =$_SESSION['cart'][$key]['quantity'];?> <td><a href="removefromcart.php?cartoon_id=<?php echo $_SESSION['cart'][$key]['cartoon_id'];?>&location=<?php echo $_SERVER['PHP_SELF'];?>">[REMOVE]</a></td> </tr> <?php }?> </table> <p> <?php } else { ?> No cartoon chosen yet <?php } ?> </p> <p> </p> <form action="rmgallery.php" method="get"> <input name="back" type="submit" value="BACK TO GALLERY" title=" Takes you back to the gallery page."/> </form> <form action= "checkoutlogin.php" method="get"> <input nane= "get" type="submit" value="GENERAL ORDER" title="A general order will allow you to purchase the cartoons in your shopping cart." /> </form> <form action="questionform.php" method="get"> <input name="get" type="submit" value="PERSONAL ORDER" title="A personal order will allow you to give a description of details you would like in your cartoon." /> </form> <p> </p> <p> </p> </div> <div class="content_text"></div> <div class="title"></div> <div class="content_text"><br /> <br /> </div>
-
A sql error message on my website, pls Im new to php and sql!
callisto11 replied to callisto11's topic in PHP Coding Help
To darkfreaks, It still giving the same error! -
A sql error message on my website, pls Im new to php and sql!
callisto11 replied to callisto11's topic in PHP Coding Help
To darkfreaks, This is the code of what Im trying to do: <?php session_start(); require "connect.php"; $email = $_SESSION['email']; $quantity = $_GET['quantity']; $query = "insert into new_order values (0,'".$date_of_order."','".$date_paid."',0,'".$customer_id."')"; $result = mysql_query($query, $connection) or die (mysql_error ()); $order_id = mysql_insert_id($connection); foreach($_SESSION['cart'] as $key => $cartoon) { $query = "insert into general_cartoon_order ('".$order_id."','".$_SESSION['cart'][$key]['cartoon_id']."','".$_SESSION['cart'][$key]['date']."','".$_SESSION['cart'][$key]['quantity']."','".$_SESSION['cart'][$key]['size']."','".$_SESSION['cart'][$keys]['price']."')"; echo $query; $result = @mysql_query($query, $connection) or die ("Unable to perform query<br>$query"); } unset($_SESSION['cart']); header("Location: rmcheckout.php"); exit(); ?> -
Hi Everyone, Im getting this sql error message on my website, which I dont understand, I know it has nothing to do with php. I was just hoping someone with php and sql experience will understand it and explain it more to me what I have done wrong. Thank you ??? Error Message: Cannot add or update a child row: a foreign key constraint fails (`rm_production/new_order`, CONSTRAINT `new_order_ibfk_1` FOREIGN KEY (`customer_id`) REFERENCES `customer` (`customer_id`))
-
To Helmet again, You are a true life saver, it worked! Thank yoooooooooooooou so much, for not commenting on my knowledge and understanding in php, unlike some people on this site Im just building sample website,(its a project) it not going to be hosted, so security would not be needed. I will always have you in mind for next time. have a great day!
-
To Helmet, Heres copy of my shopping cart script, you see Im very new new to php, so could you break down your explaination around my code please: <?php session_start(); //at the top of all pages. sessions it stores the data about the user in the web server. //the session stores session variables for each user,when a session is started the client //is given a session identifier if (isset($_SESSION['cart'])) { ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title></title> <link rel="stylesheet" type="text/css" href="style.css" /> <style type="text/css"> <!-- .style1 {color: #000000} .style7 { font-size: 12px; color: #000000; } .style8 { font-size: 12px; font-weight: bold; color: #000000; } .style12 { font-size: 14px; color: #000000; } .style19 {font-size: 14px; color: #000000; font-weight: bold; } --> </style> </head> <body> <div id="top_menu"></div> <div id="main_content"> <div id="top_banner"> <a href="index.html"><img src="images/roar.jpg" width="391" height="130" alt="home" title="logo" border="0" class="logo" /></a> </div> <div > <div class="title style1"> <p><strong>Shopping Cart</strong></p> </div> <div class="content_text"> <table width="40%" border="1" bordercolor="black" bgcolor=""> <tr> <th width="5%"> <span class="style7">STYLE NUMBER</span></th> <th width="6%"> <span class="style7">DETAILS</span></th> <th width="6%"> <span class="style8">QUANTITY</span></th> <th width="7%"> <span class="style8">SIZE </span></th> <th width="7%"> <span class="style8">PRICE (per cartoon) </span></th> <th width="8%"> -</th> <?php foreach ($_SESSION['cart'] as $key => $general_cartoon) { ?> </tr> <tr> <td><span class="style19"><?php echo $_SESSION['cart'][$key] ['cartoon_id']; ?></span></td> <td><span class="style19"><?php echo $_SESSION['cart'][$key] ['title']; ?></span></td> <td><span class="style19"><?php echo $_SESSION['cart'][$key] ['quantity'];?></span></td> <td><span class="style19"><?php echo $_SESSION['cart'][$key] ['size'];?></span></td> <td><span class="style19"><?php echo $_SESSION['cart'][$key] ['price'];?></span></td> <?php $quantity =$_SESSION['cart'][$key]['quantity'];?> <td><a href="removefromcart.php?cartoon_id=<?php echo $_SESSION['cart'][$key]['cartoon_id'];?>&location=<?php echo $_SERVER['PHP_SELF'];?>">[REMOVE]</a></td> </tr> <?php }?> </table> <p> <?php } else { ?> No cartoon chosen yet <?php } ?> </p>
-
Hi Everyone, I have a problem, I've created a shopping cart in php, this is what happens: -When a user presses the add button on a gallery page it adds the details of the item to the shopping cart. -This works perfectly fine. -What I really need help with is, how I can let the user see how many items they have in their shopping cart on other pages while they are still browsering the site. -So once they pressed the add button it will show the total quantity of cart. I hope this is clear enough. Thank you ???
-
need help with count element in php (for my checkout script
callisto11 replied to callisto11's topic in PHP Coding Help
This is my code for my checkout script, Im tryin to add all the quantity field together and all the price field together and get it to display in the total quantity fields and total price field, but I dont think im using the right element element right. I've had a go but I dont know whats happening coz it not doing anything. I dont think i've done it the right way, I've Hightlight my problem area in red. Im very sorry everyone, all this, is very new to me! Pls tak with e it easy with me. I've added the ; to close the echo, i've removed the session on cartoon_id, but i still not gettin what i want to work! It's an old code from my last checkout script i made, im reusing it. <?php session_start(); ?> <?php if (isset ($_SESSION['cart'])){ ?> <body> <center> <h1><img src="logo.jpg" align=center width="400" height="110"></h1> </center> <font face="scans-serif" color="Purple" size="5" align="right" >Order</font> <p><?php $usr = $_SESSION['email']; echo $usr;?>logged In</p> <p>Please Check your order</p> <table width="30%" border="1" bgcolor=""> <tr> <th width="5%"> STYLE NUMBER</th> <th width="6%"> DETAILS</th> <th width="6%"> QUANTITY</th> <th width="7%"> SIZE </th> <th width="7%"> PRICE </th> <?php foreach ($_SESSION['cart'] as $key => $general_cartoon) { ?> <tr> <td><?php echo $_SESSION['cart'][$key] ['cartoon_id']; ?></td> <td><?php echo $_SESSION['cart'][$key] ['title']; ?></td> <td><?php echo $_SESSION['cart'][$key] ['quantity'];?></td> <td><?php echo $_SESSION['cart'][$key] ['size'];?></td> <td><?php echo $_SESSION['cart'][$key] ['price'];?></td> <?php $quantity =$_SESSION['cart'][$key]['quantity'];?> <td> <tr> <td><?php $total_quantity = count($quantity); ?></td> <td><?php $total_order_of_order = count($price); ?></td> </tr> <tr> <?php } ?> <tr></tr> <td></td> <td>Total Quantity</td> <td> <?php echo $total_quantity; ?> </td> <td></td> <tr></tr> <td></td> <td>Total Price</td> <td><?php echo $total_cost_of_order; ?></td> </tr> </table> <p> To proceed to checkout press</p> <td><a href="rmcheckoutform.php">Continue[/url] </td> <?php } else { ?> NOTHING IN YOUR CART <?php } ?> <p> For any amendments please return to your shopping cart</p> <a href="shoppingcart.php">Shopping Cart[/url] </body> </html> -
need help with count element in php (for my checkout script
callisto11 replied to callisto11's topic in PHP Coding Help
What my code is surpose to do, is print the information inside the shopping cart and then calculate the total quantity and total price. I know im missin something in the code but i don't know it is. Thats the problem im having. -
need help with count element in php (for my checkout script
callisto11 replied to callisto11's topic in PHP Coding Help
THIS IS MY CODE FOR MY CHECKOUT SCRIPT, IM TRYIN TO ADD ALL THE QUANTITY TOGETHER AND ALL THE PRICE TOGETHER AND GET IT TO DISPLAY IN THE TOTAL QUANTITY FIELD AND TOTAL PRICE FIELD, BUT I DONT THINK IM USING THE COUNT ELEMENT RIGHT. I'VE HAD A GO BUT I DONT KNOW WHATS HAPPEN COZ IT NOT DOING ANYTHING. I DON'T THINK I'VE PUT IN THE RIGHT WAY. PLS HELP, IM VERY NEW TO PHP. I'VE HIGHLIGHT MY PROBLEM AREA IN RED. Im very sorry everyone, all this, is very new to me! Pls tak with e it easy with me. I've added the ; to close the echo, i've removed the session on cartoon_id, but i still not gettin what i want to work! <?php session_start(); ?> <?php if (isset ($_SESSION['cart'])){ ?> <body> <center> <h1><img src="logo.jpg" align=center width="400" height="110"></h1> </center> <font face="scans-serif" color="Purple" size="5" align="right" >Order</font> <p><?php $usr = $_SESSION['email']; echo $usr;?>logged In</p> <p>Please Check your order</p> <table width="30%" border="1" bgcolor=""> <tr> <th width="5%"> STYLE NUMBER</th> <th width="6%"> DETAILS</th> <th width="6%"> QUANTITY</th> <th width="7%"> SIZE </th> <th width="7%"> PRICE </th> <?php foreach ($_SESSION['cart'] as $key => $general_cartoon) { ?> <tr> <td><?php echo $_SESSION['cart'][$key] ['cartoon_id']; ?></td> <td><?php echo $_SESSION['cart'][$key] ['title']; ?></td> <td><?php echo $_SESSION['cart'][$key] ['quantity'];?></td> <td><?php echo $_SESSION['cart'][$key] ['size'];?></td> <td><?php echo $_SESSION['cart'][$key] ['price'];?></td> <?php $quantity =$_SESSION['cart'][$key]['quantity'];?> <td> <tr> <td><?php $total_quantity = count($quantity); ?></td> <td><?php $total_order_of_order = count($price); ?></td> </tr> <tr> <?php } ?> <tr></tr> <td></td> <td>Total Quantity</td> <td> <?php echo $total_quantity; ?> </td> <td></td> <tr></tr> <td></td> <td>Total Price</td> <td><?php echo $total_cost_of_order; ?></td> </tr> </table> <p> To proceed to checkout press</p> <td><a href="rmcheckoutform.php">Continue[/url] </td> <?php } else { ?> NOTHING IN YOUR CART <?php } ?> <p> For any amendments please return to your shopping cart</p> <a href="shoppingcart.php">Shopping Cart[/url] </body> </html>