I have the following Codeigniter code to display a form with two buttons for submitting an image. I need to know which button was pressed by the user. Usually I just refer to the name or value that is passed, but nothing is transmitted from these buttons. All other fields / text fields, etc. On the form go through ok, but none of these buttons ....
.... what am I missing? I pondered this for several hours and did not help on the net!
That
<?
$attributes = array('id' => 'formname','name' => 'formname');
echo form_open('processform',$attributes);
$btn_input = array(
'subtype' => ''
);
echo form_hidden($btn_input);
$btn_search = array(
'type' => 'image',
'src' => '/graphics/button1.gif',
'id' => 'button1',
'name' => 'button1',
'value' => 'button1'
);
?>
<div id='1stbutton' style='text-align: center'>
<? echo form_input($btn_search);?>
</div>
<?
$btn_search = array(
'type' => 'image',
'src' => '/graphics/button2.gif',
'id' => 'button2',
'name' => 'button2',
'value' => 'button2'
);
?>
<div id='2ndbutton' style='text-align: center'>
<? echo form_input($btn_search);?>
</div>
<? echo form_close(); ?>
source
share