How to change the value of a variable using input field?
I have created a wordpress website. I want to extract each user's data using php through his/her id.
I have created this code;
?php
$userid = /* help me get the below input field's value */
$user_info = get_userdata($userId);
echo 'Username: ' . $user_info-user_login . "\n";
echo 'User roles: ' . implode(', ', $user_info-roles) . "\n";
echo 'User ID: ' . $user_info-ID . "\n";
?
input name="getUser" id="getUser" value=''/
The user will write the id of the user he wants to extract his data. and then the data will echo back.
The code is working fine but i can't set the value of "getUser" input field to "$userId" variable. Also i want that php to re-execute on input field value change.