Welcome Guest, Not a member yet? Register   Sign In
Pass button id to controller from view
#2

(This post was last modified: 08-17-2015, 06:48 PM by pdthinh.)

(08-17-2015, 05:37 PM)nofpowells Wrote: Hey guys can i pass my button id to controller?

I need this to make a select in Model.


View button code. 




Code:
<button class="btn btn-primary" data-book-id="<?php echo $historico->codigo ?>" data-target="#form-modal" data-toggle="modal">Visualizar</button>

You can set the value attribute of the button

Code:
<button class="btn btn-primary" name="button_name" value="<?php echo $id_to_set ?>" data-book-id="<?php echo $historico->codigo ?>" data-target="#form-modal" data-toggle="modal">Visualizar</button>
In the controller, you can get the set value like this

PHP Code:
$id $this->input->post('button_name'); 
Reply


Messages In This Thread
RE: Pass button id to controller from view - by pdthinh - 08-17-2015, 06:46 PM



Theme © iAndrew 2016 - Forum software by © MyBB