从文本字段回显文本

时间:2017-03-26 16:44:06

标签: javascript php html html5

我希望回应用户在他们的帐户不是"激活"喜欢这个

if(active == NULL);{

    //This is the methods i have tried.
    //In this example username is the name of the textfield.
    //I want the username to be displayed as what the typed in, but instead it just says "username"

    echo '<span style="color:#AFA;text-align:center;">Please actiave your account, username we have sent you a mail with an activation link.</span>';

    /*In this example username1 is the id of the textfield.
    I want the username to be displayed as what the typed in, but instead it just says "username"*/

    echo '<span style="color:#AFA;text-align:center;">Please activate your account, username1 we have sent you a mail with an activation link.</span>';




    }

有什么想法吗?

1 个答案:

答案 0 :(得分:1)

您需要从文本字段

获取POST值

如果您使用CORE PHP,您可以在提交按钮和表单方法中获取帖子值,如

$_POST['username'];

以你的例子这样做 (如上所述,文本字段的名称是用户名)

$username =  $_POST['username'];

echo '<span style="color:#AFA;text-align:center;">Please actiave your account, '.$username.'  we have sent you a mail with an activation link.</span>';