I am struggling to get the following code to work. I want to take input from a javascript prompt, and output it using a php echo. When I try this I get an echo with the random numbers "12313" for no apparent reason. This is my code:
echo '<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>'
, '<script type="text/javascript">'
, 'var code = prompt("Enter verification code", "");'
, 'var getcode = code;'
, '$.post("wp-members-register.php", { code: getcode }); </script>';
$buffer_data['code'] = $_POST['code'];
echo $buffer_data['code'];
I am very new to php so please bear with me. Perhaps I am not correctly posting the 'code' variable?
EDIT: Maybe somebody can show me a better way of inputting a text string and getting it in the php code to follow? Note I am working with the wp-members wordpress plugin in the wp-members-register.php file.