I am using codeigniter framework for one of my PHP project.
In form I want to use radio button for gender.
Gender
* Male
* Female
With the value 1 or for male and 2 for female.
after selection radio button value should be assign to gender.
Can any tell me how to acheive this in codigniter.
Thanks in advance.
Try Something like this
<tr><td><?php echo form_radio('gender', '1', TRUE); ?></td><td><?php echo form_label('Male', 'gender');?></td></tr>
<tr><td><?php echo form_radio('gender', '2', FALSE); ?></td><td><?php echo form_label('Female', 'gender');?></td></tr>
You can use the html tag for creating any input in codeigniter
<input type="radio" name="gender" value=1 />Male
<input type="radio" name="gender" value=2 />Female
in view file :
<input type="radio" name="gender" value=1 />Male
<input type="radio" name="gender" value=2 />Female
and in controller its looks like i show you below
$user_type=$this->input->post('radio');