jeudi 29 juin 2017

Laravel multiple form attributes need to be save in a database

i`m using this view.what i need is fill the database with complete name.

enter image description here This is the view code segment.

 <label>Name with Initials</label>
<div class="input-group">
  <span class="input-group-addon">
    <select id="name_with_initials" name="name">
      <option selected="selected" value="mr">Mr.</option>
      <option value="mrs">Mrs.</option>
      <option value="miss">Miss.</option>
    </select>
  </span>
  <input type="text" name="name_with_initials" class="form-control" placeholder="Name with Initials">
</div>

Here is the controller store function.

$registerdetails = new registerdetails;
          $title = Input::get('name');
          $name  = Input::get('name_with_initials');
        $name_with_initials = $title.' '.$name;
        $registerdetails ->name_with_initials = $request ->name_with_initials;

My model attribute for that is name_with_initials

This works fine,but save only the name not as mr mrswhy is that?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire