I write this from in Codeigniter as a form_view.php.
<?php echo form_open('form'); ?>
<h5>Man</h5>
<input type="checkbox" name="options[]" value="m"/>
<h5>Lady</h5>
<input type="checkbox" name="options[]" value="f" />
<h5>Username</h5>
<input type="text" name="username" value="" size="50" />
<div><input type="submit" value="Submit" /></div>
</form>
And then I add this data to the database like this:
$data=array(
'type'=> $_POST['options[]'],
'name'=> $_POST['name']
);
$this->db->insert('user_data',$data);
The name field is ok. But the type field has nothing. I can not find the error. Please help me.
Assuming that you want multiple values to be stored with comma (as separator) between them