I have a view which has 2 forms:
<table>
<th>Write a comment.</th>
<tr>
<td>
<?php echo form_open($this->uri->uri_string(),$form1);
echo form_textarea($comment);
echo form_submit('submit','submit');
echo form_close();
?>
</td>
</tr>
</table>
<table>
<tr>
<td>
<?php echo form_open($this->uri->uri_string());
echo form_dropdown('portion', $portion_options);
echo form_submit('book','book');
echo form_close();
?>
</td>
</tr>
</table>
In the controller I check which button was clicked and then I perform some action by adding the corresponding form's values to the database.
if(isset($_POST['book']))
{
//sending the data to the database
echo "Book button clicked";
}
if(isset($_POST['submit']))
{
//sending the data to the database
echo "Submit button clicked";
}
However when the 'book' button is clicked no action is performed. It is like the button was never clicked. Whereas when I click the 'submit' button, every action is done properly.
In the past I have used the same technique on plain php (i mean no framework, just php), and has worked fine for me. Does codeigniter need any further configuration? Am I doing something wrong?