当前位置: 动力学知识库 > 问答 > 编程问答 >

php - Display users email address on form thank-you page

问题描述:

I'm creating a forms thank-you page, the thank-you page will read:

<p>An activation link is being sent to your email address <b>[email protected]</b>. If you do not receive it, please check your spam filter. </p>

I want their email address to appear on the thank-you page (where [email protected] shows above).

What code do I need to put, to show this? The form is coded with PHP and can be seen at:

http://www.workbooks.com/sign-up/free-edition

Many thanks,

Sam

网友答案:

There are answers with suggestions to output directly from $_POST/$_GET but that would be unsafe, particularly if you don't know how well validated the user input has been up to that point. Rule 1 of dealing with user input - it is dangerous and you should never trust it.

At the very least run it through a basic PHP string sanitization function like filter_input. So something like:

<p>An activation link is being sent to your email address <b><?php echo filter_input(INPUT_POST,'email',FILTER_VALIDATE_EMAIL) ; ?></b>. If you do not receive it, please check your spam filter.</p>

If the input was not a valid email address you'll get "false" coming out there but it's infinitely better than allowing the user to put whatever they want on the page.

网友答案:

E-mail address is in POST/GET, depending on method you are using to send a form.

网友答案:

simply echo the posted form value:

<p>An activation link is being sent to your email address <b><?php echo $_POST['email'] ; ?></b>. If you do not receive it, please check your spam filter. </p>

This example is based on the fact that the input field for email has the name "email"

网友答案:

Its is very simple.You need to just add <?php echo $_POST['email'] ; ?> So it will print the Email Address.

So according to your answer it will be something like this :

<p>An activation link is being sent to your email address <b><?php echo $_POST['email'] ; ?></b>. If you do not receive it, please check your spam filter. </p>

Note: You need to have thanks file in with .php extension.

分享给朋友:
您可能感兴趣的文章:
随机阅读: