For input form I need random input name and id
I created random values $token_hash = random
Then input field
<input type="hidden" name="' .$token_hash .'" id="' .$token_hash .'" value="some_value">
Next above input form is php code to check what values get from form
echo $_POST[$token_hash] .' $_POST[$token_hash]<br>';
Problem is that $_POST[$token_hash]
echo blank value (no value)....
I tried also $_POST[' .$token_hash .']
but do not work.
Other $_POST
works, but they are like $_POST['some_value']
Seems finally get solution. Do not understand why it did not work before. If useful for someone else. Here is solution.
Create random value $token_hash = sha1(uniqid($time_when_form_submitted .'token' .$_SERVER["REMOTE_ADDR"]));
Then create session $_SESSION['token_hash'] = $token_hash;
Then pass session to input
echo '<input type="hidden" name="' .$_SESSION['token_hash'] .'" id="' .$_SESSION['token_hash'] .'" value="' .$_SESSION['token'] .'">'
Then get session value from input. This code must be above all previos $token_hash_from_input = $_SESSION['token_hash'];
Then with $_POST[$token_hash_from_input]) get input value