title: How to populate the fields from HTML form in Laravel?
body: <p>I am working on building a form in which I want to <strong>populate the fields coming from form</strong> (which I have named <code>posting.blade.php</code>) </p>
  
  <p>The controller which I have used for that is:</p>
  
  <pre class="lang-php prettyprint-override"><code>public function store(Request $request)
  {
      $this-&gt;validate($request, [
      'name' =&gt; 'required',
      'email' =&gt; 'required|email',
      'number' =&gt; 'required',
      'city' =&gt; 'required',
      'post' =&gt; 'required'
      ]);
  
      Mail::send('emails.posting-message', [
      'msg'=&gt; $request-&gt;message
      ], function($mail) use($request) {
          $mail-&gt;from($request-&gt;email, $request-&gt;name);
          $mail-&gt;to('helloworld@gmail.com')-&gt;subject('Contact Message');
      });
      return redirect()-&gt;back()-&gt;with('flash_message', 'Thank you for your message');
  }
  </code></pre>
  
  <p><br></p>
  
  <p><strong>Problem Statement:</strong></p>
  
  <p>The current controller doesn't return anything as in the line <code>'msg'=&gt; $request-&gt;message</code> there is no message in validate. But if I use </p>
  
  <p><code>'msg'=&gt; $request-&gt;name</code>    (It returns name)</p>
  
  <p>I am wondering what changes I should make in the controller so that it return every field present in the validate. </p>
  
  <p>I tried with this but its only returning the last value which is post. </p>
  
  <pre><code>       'msg'=&gt; $request-&gt;name,
         'msg'=&gt; $request-&gt;email,
         'msg'=&gt; $request-&gt;number,
         'msg'=&gt; $request-&gt;city,
         'msg'=&gt; $request-&gt;post
  </code></pre>