gilabola Posted March 12, 2010 Share Posted March 12, 2010 The Problem: When i click on hyperlink Order, it won't capture the values to be send to the table Order, example: <td><?php echo $row["PRO_ID"]; ?></td> . I assume the problem occur at the inserting proses: if (isset($_POST["order_id"])) { $CART_ID=$_POST["Cart_ID"]; $PRO_ID=$_POST["Product_ID"]; $PRO_NAME=$_POST["Product_Name"]; $PRO_PRICE=$_POST["Product_Price"]; mysql_query("insert into order (CART_ID,PRO_ID,PRO_NAME,PRO_PRICE) values ('$CART_ID','$PRO_ID','$PRO_NAME',$PRO_PRICE)"); header("Location: member_carts1.php"); } The Order concept is similar with the Delete concept that i made and it works well. Can someone show me the way? Thank you! Below is the full code: <?php ob_start(); include("dbconnection.php"); if (isset($_POST["order_id"])) { $CART_ID=$_POST["Cart_ID"]; $PRO_ID=$_POST["Product_ID"]; $PRO_NAME=$_POST["Product_Name"]; $PRO_PRICE=$_POST["Product_Price"]; mysql_query("insert into order (CART_ID,PRO_ID,PRO_NAME,PRO_PRICE) values ('$CART_ID','$PRO_ID','$PRO_NAME',$PRO_PRICE)"); header("Location: member_carts1.php"); } if (isset($_REQUEST["cart_id"])) { $cart_id = $_REQUEST["cart_id"]; mysql_query("delete from cart where CART_ID = $cart_id"); header("Location: member_carts1.php"); } $memid= $_SESSION["memid"]; $result = mysql_query("select * from cart"); ?> <?php while($row=mysql_fetch_assoc($result)) { ?> <tr> <td><?php echo $row["PRO_ID"]; ?></td> <td><?php echo $row["PRO_NAME"]; ?></td> <td><?php echo $row["PRO_PRICE"]; ?></td> <td><a href = "member_view_product?cart_id=<?php echo $row['CART_ID']; ?>">View</a></td> <td><a href = "member_carts1.php?cart_id=<?php echo $row['CART_ID']; ?>" onclick="return confirmation();">Delete</a></td> <td><a href = "member_carts1.php?order_id=<?php echo $row['CART_ID']; ?>">Order</a></td> Quote Link to comment https://forums.phpfreaks.com/topic/195011-inserting-value-from-a-table-to-another-table-using-checkbox/ Share on other sites More sharing options...
Adam Posted March 12, 2010 Share Posted March 12, 2010 Very vague description of the problem, but I think you need to pass the variables through the URL, for example: <td><a href = "member_carts1.php?order_id=<?php echo $row['CART_ID']; ?>&pro_id=<?php echo $row["PRO_ID"]; ?>&pro_name=<?php echo $row["PRO_NAME"]; ?>&pro_price=<?php echo $row["PRO_PRICE"]; ?>">Order</a></td> If this isn't the solution you need to provide more information. Quote Link to comment https://forums.phpfreaks.com/topic/195011-inserting-value-from-a-table-to-another-table-using-checkbox/#findComment-1025238 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.