title: HTML/PHP Laravel - Select random data from input
body: <p>The code is working fine at a glance. Problem is in spite of adding <strong>required</strong> term in the input form, without any input the form can be submitted.</p>
  <p>Second thing is, submitted form showing the random value which is already set. I want when any input which matches the names in the <strong>newwelcome.blade.php</strong> file will return success message. If not matches with the input, it will show &quot;Wrong guessed&quot;</p>
  <p>Here is my code:
  newwelcome.blade.php</p>
  <pre><code>&lt;?php
  function randomName() {
      $names = array(
          'Alfa',
          'BMW',
          'Opel',
          'Ford',
          'Jaguar',
          // and so on
  
      );
      
      return $names[rand ( 0 , count($names) -1)];
  }
  
  print randomName();
  </code></pre>
  <p>brandform.blade.php</p>
  <pre><code>&lt;!doctype html&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;title&gt;Car Brand Game!&lt;/title&gt;
  
      &lt;!-- load bootstrap --&gt;
      &lt;link rel=&quot;stylesheet&quot; href=&quot;//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css&quot;&gt;
      &lt;style&gt;
          body    { padding-bottom:40px; padding-top:40px; }
      &lt;/style&gt;
  &lt;/head&gt;
  &lt;body class=&quot;container&quot;&gt;
  
  &lt;div class=&quot;row&quot;&gt;
      &lt;div class=&quot;col-sm-8 col-sm-offset-2&quot;&gt;
          &lt;div class=&quot;page-header&quot;&gt;
              &lt;h1&gt;&lt;span class=&quot;glyphicon glyphicon-flash&quot;&gt;&lt;/span&gt; Car Brand Game&lt;/h1&gt;
          &lt;/div&gt;
  
          &lt;!-- FORM STARTS HERE --&gt;
          &lt;form method=&quot;POST&quot; input name=&quot;feature&quot; id=&quot;feature&quot; action=&quot;newwelcome.blade.php&quot; novalidate&gt;
  
              &lt;div class=&quot;form-group&quot;&gt;
                  &lt;label for=&quot;name&quot;&gt;Your guessed car brand:&lt;/label&gt;
                  &lt;input type=&quot;text&quot; id=&quot;name&quot; class=&quot;form-control&quot; name=&quot;name&quot; placeholder=&quot;Which car brand was selected by the system?&quot; required&gt;
                  
              &lt;/div&gt;
              &lt;button type=&quot;submit&quot; class=&quot;btn btn-success&quot;&gt;Submit&lt;/button&gt;
  
          &lt;/form&gt;
  
      &lt;/div&gt;
  
  &lt;/body&gt;
  </code></pre>