title: How to check prime number in PHP with an input
body: <p>I need help for my php program to find a prime number. This is my code:</p>
  
  <pre><code>&lt;form method="post" action=""&gt;
      &lt;table border="1" width="180px"&gt;
          &lt;thead&gt;
              &lt;tr bgcolor="yellow"&gt;
                  &lt;th&gt;#&lt;/th&gt;
                  &lt;th&gt;Data 1&lt;/th&gt;
                  &lt;th&gt;Data 2&lt;/th&gt;
                  &lt;th&gt;Data 3&lt;/th&gt;
              &lt;/tr&gt;
          &lt;/thead&gt;
  
          &lt;?php 
              error_reporting(0);
  
              $start = 21;
              $n_rows = 5;
              $n_cols = 4;
  
              for ($i = 0; $i &lt; $n_rows; $i++) {
                  $row = '';
                  for ($j = 0; $j &lt; $n_cols; $j++) {
                      $row .= '&lt;td&gt;'. ($start + $i + ($j * $n_rows)). '&lt;/td&gt;';
                  }
                  $out .= '&lt;tr&gt;'. $row. '&lt;/tr&gt;';
              }
  
              echo $out;
           ?&gt;
  
          &lt;tr&gt;   
              &lt;td colspan=4&gt;
                      &lt;center&gt;
                          &lt;label for="input"&gt;Initial value:&lt;/label&gt;
                          &lt;input type="text" name="awal" style="width: 60px"&gt;
                          &lt;input type="submit" name="submit" value="Send"&gt;
                      &lt;/center&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
      &lt;/table&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>The question is, <strong>how to check if we enter the initial value of the input to find prime numbers? If prime then the number will be red, and if it not prime will be black.</strong> </p>
  
  <p>I need the code to make it, any response would be greatly appreciated. </p>