<script src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript" src="http://jzaefferer.github.com/jquery-validation/jquery.validate.js"></script>
<?php $this->load->view('includes/header'); ?>
<div class="container-fluid" style=" min-height: 500px; " >
<div class="row-fluid">
<?php $this->load->view('includes/sidebar'); ?>
<?php $this->load->view($main_content); ?>
</div>
</div>
<form id="print" method="post" action="<?php echo base_url().'index.php/'; ?>printdocument/print_a_document">
<div class="controls">
<input style="width: 185px;" id="print_button" type="submit" value="Print">
<input type="hidden" name="print_template" value="<?php echo $main_content; ?>">
<input type="hidden" name="records" value="<?php echo $records; ?>">
<input type="hidden" name="print_template" value="<?php echo $main_content; ?>">
</div>
</form>
then in controller
class Printdocument extends CI_Controller{
function print_a_document()
{
$data['main_content'] = $this->input->post('print_template');
$data['records'] = $this->input->post('records');
$this->load->view('includes/print_template', $data);
}
}
I need to pass records How to pass them?
A PHP Error was encountered
Severity: Notice
Message: Array to string conversion
Filename: includes/template_print.php
Line Number: 16
Array”>
Your problem is you are trying to assign a string to a array. It to be noted you doing it for a array and not a array element. Thus the problem what your are facing. Post a array of the data you want to print and save it to
$dataarray.