I am trying to send an identifier from a view to a controller in CodeIgniter. My requirement is to switch functions based on the id button. Here is my HTML code.
HTML view
<?php echo form_open_multipart('upload_control/switch_load','id="bt_addImage"');?>
<input id= "bt_addImage" type="submit" value="Add Image" /> <br>
<?php echo form_open_multipart('upload_control/switch_load','id="bt_chooseImage"');?>
<input type="submit" id="bt_chooseImage" value="Submit"/><br>
Upload_control.php Code
public function switch_load($id)
{
if($id == "bt_addImage")
{
do_loadcategories();
}
else
{
do_upload();
}
}
public function do_loadcategories()
{
}
public function do_upload()
{
}
Is it correct?
or
is there any other way to do this?
help me solve the problem.
source
share