title: Making Random field in HTML Form
body: <p>I have the following code to generate a random string</p>
  
  <pre><code>function generateRandomString($length = 10) {
    $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
    $randomString = '';
    for ($i = 0; $i &lt; $length; $i++) {
      $randomString .= $characters[rand(0, strlen($characters) - 1)];
    }
    return $randomString;
  }
  $s= generateRandomString();
  </code></pre>
  
  <p>And have an HTML Form in which the name field gets the random string in that form</p>
  
  <pre><code>&lt;input type="text" maxlength="10" name="&lt;?php echo $s;?&gt;" class="tracer-number-input"/&gt;
  </code></pre>
  
  <p>Now how do I make sure to get POST of that Random string when I use this</p>
  
  <pre><code>$num = $_POST[$s];
  </code></pre>
  
  <p>It does not work as expected because when I click the submit button of the HTML form, the page reloads and the random string is changed so the POST form does not got the previous random value. That breaks my logic.</p>
  
  <p>The main motive is to make a HTML form in which the name of the input field is random and the post field will also get that random string.</p>
  
  <p>I want to prevent the autoscript to make submission as every time this generate different POST field and then the autoscript is unable to process even if I have not added a captcha </p>