Please i'm stucked with this problem for an hour now(yeah i'm newbie in this).
this is a piece of code in my controller
and this is the view(index.php). i also wanted to see the query i did,so tried to output it with last_query() :
and the printed result is:
what i want to achieve is something like this depending on the selected checbox by their id:
The Checked boxes names were: sun, heaven, earth
this is a piece of code in my controller
PHP Code:
$tags = $this->input->post('check_list');
foreach($tags as $t){
$q = $this->db->get_where('info', array('text_id' => $t))->result()->text_name;
//$data['q'] = $this->db->get_where('info', array('text_id' => $t))->result()->text_name;
$data['qe'] = $q.' ,';
}
and this is the view(index.php). i also wanted to see the query i did,so tried to output it with last_query() :
PHP Code:
<?php
echo form_open();
?>
<input type="checkbox" name="check_list[]" value="1">love<br>
<input type="checkbox" name="check_list[]" value="2">heart<br>
<input type="checkbox" name="check_list[]" value="3">heaven<br>
<input type="checkbox" name="check_list[]" value="4">sun<br>
<input type="checkbox" name="check_list[]" value="5">earth<br>
<?php
echo form_submit('', 'Save');
echo form_close();
?>
<div>The Checked boxes names were:
<?php echo $qe;
var_dump($qe);
var_dump($this->db->last_query());
?></div>
and the printed result is:
Code:
,string(2) " ," string(4) "SELECT * FROM `info` WHERE `text_id` = '4'"what i want to achieve is something like this depending on the selected checbox by their id:
The Checked boxes names were: sun, heaven, earth