Jump to content

Recommended Posts

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>

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.

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.