I have a register form where users can sign up and I recently added two radio buttons to define users type.
Example:
(*) I want to buy (*) I want to sell
Here's how I was thinking to do this: I added a boolean field in the users table and I was thinking to check if I want to buy is checked then I store 1 in the database if the other one is checked then I store 0.
The thing is, I'm not sure how to check in the controller if the radio button is selected or not.. I tried to look in the documentation and on google but all I found were some ideas using the Form facade which as I know is no longer used in 5.4...
HTML
{{ Form::radio('result', 'buy' , true) }}
{{ Form::radio('result', 'sell' , false) }}
Without Form Facade
<input type="radio" name="result" value="buy" checked>
<input type="radio" name="result" value="sell">
Controller
$fields = Input::get('result');
if($fields == 'buy'){
// logic
}
else{
// logic
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With