You mean something like this?

 

<div class="list_item" id="<?php echo h($product['Product'][id]); ?>">

 

Dave Maharaj

Freelance Designer | Developer
Description: header_logo
www.movepixels.com  |   <mailto:[email protected]> [email protected]  |
709.800.0852

 

From: [email protected] [mailto:[email protected]] On Behalf
Of Chandra Sekhar
Sent: Tuesday, September 24, 2013 7:41 AM
To: [email protected]
Subject: cakephp foreach loop problem

 

I passed id from foreach loop and i would like to use the entire row using
that id how?

my code is

 

<?php foreach ($products as $product): ?>

            <div class="list_item">

                        <img src="http://localhost/maanyadev/img/uploads/
<http://localhost/maanyadev/img/uploads/%3c?php%20echo%20h($product%5b'Produ
ct'%5d%5b'img'%5d);%20?%3e> <?php echo h($product['Product']['img']); ?>"
height="100" width="100" id="img">

                        <div><b>Name:</b><?php echo
h($product['Product']['name']); ?><br >

                        

                        <b>Price:</b><?php echo
h($product['Product']['price']); ?>&nbsp;

                        <br >

                        

                        <!--<?php echo $this->Html->link(('Add to Cart'),
array('controller' => 'products', 'action'=>'addtocart',
$product['Product']['id'])); ?>-->

                        <?php 

                        

                        $pd = $product['Product']['id'];

                        echo
$this->Html->link('Addtocart',$product['Product']['id'],array('onClick'=>'te
st1('.$pd.');return false;')); ?>      

                        

                                    </div></div>

<?php endforeach; ?>

 

 

and js code is

 

<script>

 

            function test1(id)

            {

                        alert(id);

                        // in this are how to use $product['Product']['id']
and other fields how to use here

}

</script>

 

 

 

 

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
--- 
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.

<<image001.jpg>>

Reply via email to