Advertisement
freddy0512

uhuh

Apr 10th, 2015
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.13 KB | None | 0 0
  1. public function submit ()
  2.         {
  3.             if(isset($_POST['cetak']))
  4.             {
  5.  
  6.  
  7.  
  8. //is that correct put $data here  ?
  9. $PDFContent=$this->load->view('admin/laporan/cetak_laporan', $data, true);
  10.  
  11. //do i wrong make variable data ?
  12. $data = $this->penjualan_model->cetak();
  13.  
  14. $url = 'http://freehtmltopdf.com';
  15.  
  16.  
  17. $data = array('convert' => '',
  18.               'html' => $PDFContent,
  19.               'baseurl' => base_url(),
  20.               'width' => '210mm',
  21.               'enablejs' => 0,
  22.               'orientation' => 'portrait');
  23.  
  24.  
  25.  //i'm still dont understand $data
  26. $options = array('http' => array('header'  => "Content-type: application/x-www-form-urlencoded\r\n",
  27.                                  'method'  => 'POST',
  28.                                  'content' => http_build_query($data)),);
  29.  
  30. $context  = stream_context_create($options);
  31.  
  32. $result = file_get_contents($url, false, $context);
  33.  
  34. header('Content-type: application/pdf');
  35.  
  36. echo $result;
  37.  
  38.  
  39.     }
  40.  
  41.  
  42.  
  43.  
  44.         else if (isset($_POST['cari']))
  45.         {
  46.                 $data['data'] = $this->penjualan_model->cetak();
  47.                 $this->load->view('admin/laporan/cari_laporan', $data);
  48.                
  49.         }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement