I have the following code to generate a random string
function generateRandomString($length = 10) {
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$randomString = '';
for ($i = 0; $i < $length; $i++) {
$randomString .= $characters[rand(0, strlen($characters) - 1)];
}
return $randomString;
}
$s= generateRandomString();
And have an HTML Form in which the name field gets the random string in that form
<input type="text" maxlength="10" name="<?php echo $s;?>" class="tracer-number-input"/>
Now how do I make sure to get POST of that Random string when I use this
$num = $_POST[$s];
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.
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.
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
<input type="hidden" name="tracer-number-input" value="<?php echo $s;?>"/>