Wordpress Php print / echo input results from previous page
I am trying to create a php function in wordpress where a user answers a question on one page and then prints their answer on the next page after they hit submit.
The data does not need to be collected in开发者_开发知识库 a database just printed so it shows what the user typed.
Thanks in advance!
You could use a form to do this. Create HTML form with an input for the answer that gets submitted to a php file on submit:
<form action="print.php" method="POST">
<input type="text" name="user_answer" />
<input type="submit" value="answer question!" />
</form>
Then have a PHP file (called print.php in this example);
$answer = $_POST['user_answer'];
echo $answer;
精彩评论