Save all HTML field names in Controller - it is bad or not bad idea?

Clash Royale CLAN TAG#URR8PPP
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;
up vote
0
down vote
favorite
I have sample controller InboxController in my Inbox app. I want control with field name from my controller. If I will control with fields name from controller will not be destroyed MVC rules?
<?php
namespace AppHttpControllers;
use AppUser;
use IlluminateHttpRequest;
use IlluminateSupportFacadesValidator;
class InboxController extends Controller
--------------------------------------------------------------------------
*/
/**
* Recipient field name.
*
* @var string
*/
public $recipient = 'recipient';
/**
* Sender field name.
*
* @var string
*/
public $sender = 'sender';
/**
* Subject field name.
*
* @var string
*/
Html code:
<input type='text' name=" $sender ">
php laravel
add a comment |Â
up vote
0
down vote
favorite
I have sample controller InboxController in my Inbox app. I want control with field name from my controller. If I will control with fields name from controller will not be destroyed MVC rules?
<?php
namespace AppHttpControllers;
use AppUser;
use IlluminateHttpRequest;
use IlluminateSupportFacadesValidator;
class InboxController extends Controller
--------------------------------------------------------------------------
*/
/**
* Recipient field name.
*
* @var string
*/
public $recipient = 'recipient';
/**
* Sender field name.
*
* @var string
*/
public $sender = 'sender';
/**
* Subject field name.
*
* @var string
*/
Html code:
<input type='text' name=" $sender ">
php laravel
what are we supposed to be reviewing here? the two controller properties? yes, those are very nice. i have no suggestions. if you want to do something with them and you're not sure how, you should try asking on stackoverflow.
â Occam's Razor
Jan 9 at 17:15
I just wanted to ask if it would be bad if the field names on the HTML form will be defined on the controller @I wrestled a bear once.
â Otabek
Jan 10 at 2:52
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have sample controller InboxController in my Inbox app. I want control with field name from my controller. If I will control with fields name from controller will not be destroyed MVC rules?
<?php
namespace AppHttpControllers;
use AppUser;
use IlluminateHttpRequest;
use IlluminateSupportFacadesValidator;
class InboxController extends Controller
--------------------------------------------------------------------------
*/
/**
* Recipient field name.
*
* @var string
*/
public $recipient = 'recipient';
/**
* Sender field name.
*
* @var string
*/
public $sender = 'sender';
/**
* Subject field name.
*
* @var string
*/
Html code:
<input type='text' name=" $sender ">
php laravel
I have sample controller InboxController in my Inbox app. I want control with field name from my controller. If I will control with fields name from controller will not be destroyed MVC rules?
<?php
namespace AppHttpControllers;
use AppUser;
use IlluminateHttpRequest;
use IlluminateSupportFacadesValidator;
class InboxController extends Controller
--------------------------------------------------------------------------
*/
/**
* Recipient field name.
*
* @var string
*/
public $recipient = 'recipient';
/**
* Sender field name.
*
* @var string
*/
public $sender = 'sender';
/**
* Subject field name.
*
* @var string
*/
Html code:
<input type='text' name=" $sender ">
php laravel
asked Jan 9 at 6:17
Otabek
169110
169110
what are we supposed to be reviewing here? the two controller properties? yes, those are very nice. i have no suggestions. if you want to do something with them and you're not sure how, you should try asking on stackoverflow.
â Occam's Razor
Jan 9 at 17:15
I just wanted to ask if it would be bad if the field names on the HTML form will be defined on the controller @I wrestled a bear once.
â Otabek
Jan 10 at 2:52
add a comment |Â
what are we supposed to be reviewing here? the two controller properties? yes, those are very nice. i have no suggestions. if you want to do something with them and you're not sure how, you should try asking on stackoverflow.
â Occam's Razor
Jan 9 at 17:15
I just wanted to ask if it would be bad if the field names on the HTML form will be defined on the controller @I wrestled a bear once.
â Otabek
Jan 10 at 2:52
what are we supposed to be reviewing here? the two controller properties? yes, those are very nice. i have no suggestions. if you want to do something with them and you're not sure how, you should try asking on stackoverflow.
â Occam's Razor
Jan 9 at 17:15
what are we supposed to be reviewing here? the two controller properties? yes, those are very nice. i have no suggestions. if you want to do something with them and you're not sure how, you should try asking on stackoverflow.
â Occam's Razor
Jan 9 at 17:15
I just wanted to ask if it would be bad if the field names on the HTML form will be defined on the controller @I wrestled a bear once.
â Otabek
Jan 10 at 2:52
I just wanted to ask if it would be bad if the field names on the HTML form will be defined on the controller @I wrestled a bear once.
â Otabek
Jan 10 at 2:52
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
2
down vote
accepted
I recomend you to use Symfony like form builder. There you can create one form and reuse it anywhere.
$form = FormFactory::create(FormType::class, $user)
->add('name', TextType::class)
->add('email', EmailType::class, [
'rules' => 'unique:users,email',
])
->add('save', SubmitType::class, ['label' => 'Save user']);
What is also good is with this form you can also validate your input at the same time.
$form->handleRequest();
if ($form->isSubmitted() && $form->isValid())
//Your code
Here is link for repository
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
accepted
I recomend you to use Symfony like form builder. There you can create one form and reuse it anywhere.
$form = FormFactory::create(FormType::class, $user)
->add('name', TextType::class)
->add('email', EmailType::class, [
'rules' => 'unique:users,email',
])
->add('save', SubmitType::class, ['label' => 'Save user']);
What is also good is with this form you can also validate your input at the same time.
$form->handleRequest();
if ($form->isSubmitted() && $form->isValid())
//Your code
Here is link for repository
add a comment |Â
up vote
2
down vote
accepted
I recomend you to use Symfony like form builder. There you can create one form and reuse it anywhere.
$form = FormFactory::create(FormType::class, $user)
->add('name', TextType::class)
->add('email', EmailType::class, [
'rules' => 'unique:users,email',
])
->add('save', SubmitType::class, ['label' => 'Save user']);
What is also good is with this form you can also validate your input at the same time.
$form->handleRequest();
if ($form->isSubmitted() && $form->isValid())
//Your code
Here is link for repository
add a comment |Â
up vote
2
down vote
accepted
up vote
2
down vote
accepted
I recomend you to use Symfony like form builder. There you can create one form and reuse it anywhere.
$form = FormFactory::create(FormType::class, $user)
->add('name', TextType::class)
->add('email', EmailType::class, [
'rules' => 'unique:users,email',
])
->add('save', SubmitType::class, ['label' => 'Save user']);
What is also good is with this form you can also validate your input at the same time.
$form->handleRequest();
if ($form->isSubmitted() && $form->isValid())
//Your code
Here is link for repository
I recomend you to use Symfony like form builder. There you can create one form and reuse it anywhere.
$form = FormFactory::create(FormType::class, $user)
->add('name', TextType::class)
->add('email', EmailType::class, [
'rules' => 'unique:users,email',
])
->add('save', SubmitType::class, ['label' => 'Save user']);
What is also good is with this form you can also validate your input at the same time.
$form->handleRequest();
if ($form->isSubmitted() && $form->isValid())
//Your code
Here is link for repository
answered Jan 10 at 7:49
Ziya Vakhobov
361
361
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f184633%2fsave-all-html-field-names-in-controller-it-is-bad-or-not-bad-idea%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
what are we supposed to be reviewing here? the two controller properties? yes, those are very nice. i have no suggestions. if you want to do something with them and you're not sure how, you should try asking on stackoverflow.
â Occam's Razor
Jan 9 at 17:15
I just wanted to ask if it would be bad if the field names on the HTML form will be defined on the controller @I wrestled a bear once.
â Otabek
Jan 10 at 2:52