How can I pass variables in a foreach loop into a view?

#1
[eluser]alexandervj[/eluser]
I have a table populated with a foreach loop. I'm trying to make it so when you click on the search20.png image it opens the popup view, and passes the corresponding $subtime for that row into the popup view to use.

It works ok except that for each search20.png image you click on it gives the same $subtime. I'm not sure how to go about making it so that the $subtime corresponds to the $r->Submitted variable for each row in the table. Here's my code...

Thanks!

Code:
<table width="100%">
   <tr >
    <td></td>
    <td  bold;" min-width="120px">Submitted:</td>
    <td  bold;" min-width="120px">First Name:</td>
    <td  bold;" min-width="120px">Last Name:</td>
    <td  bold;" min-width="150px">Email:</td>
    <td  bold;" min-width="100px">Phone Number:</td>
    <td  bold;">Sent:</td>
   </tr>
   &lt;?php foreach($rows as $r){ ?&gt;
   &lt;?php $data['subtime'] = $r->Submitted; ?&gt;
   <tr>
    <td  vertical-align: middle;">
        <div class="button"><a href="#"><img src="assets/images/search20.png"/></a></div>
        &lt;?php $this->load->view('popup', $data); ?&gt;
    </td>
    <td>&lt;?php echo date("F j, Y, g:i a", $r->Submitted); ?&gt;</td>
    <td>&lt;?php echo $r->firstName; ?&gt;</td>
    <td>&lt;?php echo $r->lastName; ?&gt;</td>
    <td>&lt;?php echo $r->email; ?&gt;</td>
    <td>&lt;?php echo $r->phone; ?&gt;</td>
    <td ">&lt;input type="checkbox" name="check" value="check"&gt;&lt;/td>
   </tr>
  &lt;?php } ?&gt;
  </table>


Messages In This Thread
How can I pass variables in a foreach loop into a view? - by El Forum - 10-03-2014, 08:14 AM
How can I pass variables in a foreach loop into a view? - by El Forum - 10-03-2014, 03:19 PM
How can I pass variables in a foreach loop into a view? - by El Forum - 10-03-2014, 07:28 PM
How can I pass variables in a foreach loop into a view? - by El Forum - 10-03-2014, 08:17 PM
How can I pass variables in a foreach loop into a view? - by El Forum - 10-03-2014, 09:56 PM
How can I pass variables in a foreach loop into a view? - by El Forum - 10-06-2014, 08:16 AM
How can I pass variables in a foreach loop into a view? - by El Forum - 10-06-2014, 05:00 PM
How can I pass variables in a foreach loop into a view? - by El Forum - 10-14-2014, 03:31 PM
How can I pass variables in a foreach loop into a view? - by El Forum - 10-15-2014, 06:29 AM
How can I pass variables in a foreach loop into a view? - by El Forum - 10-16-2014, 09:31 AM
How can I pass variables in a foreach loop into a view? - by El Forum - 10-16-2014, 05:48 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.