title: Laravel Input Data To the Session When the User Did Not Fill Up The Required Field
body: <p>I need the filled field remains its input data. but this happened it's gone. What should I do to make it still remain? I used Laravel 5.4. already used this command " $req->flash(); " but still failed </p>
  
  <p><a href="https://i.stack.imgur.com/x3CEe.jpg" rel="nofollow noreferrer">Here is my output</a></p>
  
  <p><strong>and this is my code:</strong></p>
  
  <pre><code>public function register_create(Request $req) {
          $req-&gt;flash();
          $req-&gt;validate([
          'name' =&gt; 'required',
          'matrix-number' =&gt; 'required',
          'ic-number' =&gt; 'required',
          'faculty' =&gt; 'required',
          'programme' =&gt; 'required',
          'part' =&gt; 'required',
          'group' =&gt; 'required',
          'email' =&gt; 'required',
          'phone-number' =&gt; 'required'
        ]);
  
        $name = Helpers::raw($req-&gt;input('name'));
        $matrix_number = $req-&gt;input('matrix-number');
        $ic_number = $req-&gt;input('ic-number');
        $faculty = Helpers::raw($req-&gt;input('faculty'));
        $programme = $req-&gt;input('programme');
        $part = $req-&gt;input('part');
        $group = $req-&gt;input('group');
        $email = $req-&gt;input('email');
        $phone_number = $req-&gt;input('phone-number');
  
        User::create([
          'name' =&gt; $name,
          'matrix_number' =&gt; $matrix_number,
          'ic_number' =&gt; $ic_number,
          'faculty' =&gt; $faculty,
          'programme' =&gt; $programme,
          'part' =&gt; $part,
          'group' =&gt; $group,
          'email' =&gt; $email,
          'phone_number' =&gt; $phone_number,
          'password' =&gt; $ic_number
        ]);
        {
          if (session('validate')) {
            $req -&gt; validate;
          return redirect()-&gt;action('HomeController@login');
        }
  
         else
  
         {
           $req-&gt;session()-&gt;reflash();
           $req-&gt;session()-&gt;put('some_key', $req-&gt;all());
           return redirect()-&gt;back()-&gt;withInput();
  
         }
       }
     }
  </code></pre>