i am trying to get which button is clicked from a form. I have 3 buttons in a form here is how my view looks like:
<div class="form-actions">
<button type="submit" name="submit" class="btn green"><i class="fa fa-check"></i> Submit</button>
<button type="submit" name="draft" class="btn btn-warning"><i class="fa fa-paper-plane-o"></i> Draft</button>
<button type="submit" name="Trash" class="btn red"><i class="fa fa-trash-o"></i> Trash</button>
</div>
And here is how i am checking that on my controller:
if(Button::get('submit')) {
$request['status'] = 1;
}
elseif(Input::has('draft')) {
$request['status'] = 2;
} else {
return "something else"; //i am ending us with this all the time.
}
I am always ending up with something else
. when i do the return $request->except('_token');
i get this:
{
"pagename": "asdfasdf",
"pagecontent": "<p>asdfasdf<\/p>
",
"displayfrom": "2016-02-04 00:00:00",
"submit": "",
"metatitle": "",
"metakeywords": "",
"metadescription": "",
"user": 11,
"active": 1
}
I dont know why its not getting the value of a <button type="submit">
.
Any suggestions will be helpful. Thank you!