• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
parse three array with foreach

#1
[eluser]masentinel900[/eluser]
Hello Guys!!
I'm working with CI for to do a pdf report, so I need to introduce some values in a html form (This is dinamically because there inputs according days).

The Idea is to do a report that describes the activities and foods for each one day. is like a schedule.

So the final result will some like ::

Day 1 - 28 september.
Activities: The activity according this day, this activity is typed from the html form.
Food: The same here.

Day 2 - 29 september.
Activities: and so on.
Food: And so on.

So I have two ways to do it.

The first option is to bring the three arrays from the html view
The second option is to bring only two arrays (activities and food) and the day bring it from the DB.

In this moment I have this::

Code:
$activity = $this->input->post('Activity');
$food = $this->input->post('Food');
$cActi = count($activity );
for($i=1; $i<=$cActi;){
  foreach(array_combine($activity , $food ) as $row => $key){
   $mpdf->WriteHTML('<tr><td>'.$i++. ' ' .'</td></tr>');
   $mpdf->WriteHTML('<tr><td>'."Activities: " . $row .'</td></tr>');
   $mpdf->WriteHTML('<tr><td>'."Food: " . $key .'</td></tr>');
   $mpdf->WriteHTML('<tr><td><br /></td></tr>');
   }
  }

Here all works perfect, but the problem Is that I still I don't have added the date. And I don't know how process three arrays.



Messages In This Thread
parse three array with foreach - by El Forum - 09-30-2013, 11:45 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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