Jump to content

Pass Multiple Ids From Product Page To Cart Page


vinpkl

Recommended Posts

hi all

 

i want to add multiple products using selected checkboxes to cart

 

i m passing checkbox values from product page to cart page

 

<input type="checkbox" value="1" name="related[]" />
<input type="checkbox" value="2" name="related[]" />
<input type="checkbox" value="3" name="related[]" />
<input type="submit" value="addtocart">

 

i tried below code in "cart.php" but this code output "ids" as array

 

<?

$related_all = array();

$related_all = $_REQUEST['related'];

foreach($_REQUEST['related'] as $product_id)

{
if(isset($_REQUEST['related']))
{
$id=$_REQUEST['related'];

echo $id; /* ouput as ArrayArrayArray */

$qry = "select * from product_table where product_id = $id";

echo $qry; /* output = where product_id = Array */
}
}

?>

 

vineet

Edited by vinpkl
Link to comment
Share on other sites

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.