php - how can I check which submit button is clicked -


i use laravel framework of php ...

i have form 3 submit button each of them different task . how can find in controller side 1 clicked? define name each of them when print_r($_post) there nothing buttons name . how can check 1 pressed?

    {{form::submit('send',array('class'=>'btn btn-primary','name'=>'send'))}}     {{form::submit('cancel',['class'=>'btn btn-primary','data-dismiss'=>'modal','aria-    hidden'=>'true'])}}     {{form::submit('save',array('class'=>'btn btn-primary','name'=>'save'))}} 

thanks time :)

as per comment, can set same name, , different value each submit button, check value in controller:

{{form::submit('send',array('class'=>'btn btn-primary','name'=>'action','value'=>'send'))}} {{form::submit('cancel',array('class'=>'btn btn-primary','data-dismiss'=>'modal','aria-    hidden'=>'true','name'=>'action','value'=>'cancel'))}} {{form::submit('save',array('class'=>'btn btn-primary','name'=>'action','value'=>'save'))}}  //controller:  $action = input::get('action', 'none');  if($action=='send'){    //do send }else if($action=='save'){    //do save } 

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -