提交后保留表单值 [英] keep form value after submit it

查看:108
本文介绍了提交后保留表单值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道还有很多其他的问题是这样的,我在网上找到了1.000个答案,但没有一个与我的代码一起工作:(
那么有人可以帮助我如何在提交后保留电子邮件的价值吗?

 < form name =login-registrationonSubmit =return validateForm()method =postaction => ; 
< label>电子邮件< / label>
< input type =emailname =emailinputid =emailinputvalue =/>
< p id =emptyEmailclass =hidden>需要电子邮件字段< / p>

< label>您的密码< / label>
< input type =passwordname =pswinputid =pswinputvalue =/>
< p id =pswMinMaxclass =hidden>密码应该是从4到8个字符< / p>
< p id =pswLettNumclass =hidden>密码应该是字母和数字mbers。不允许使用特殊字符< / p>
< label>重复密码< / label>
< input type =passwordname =pswrepeatinputid =pswrepeatinputvalue =onblur =isValidPswRep()/>
< p id =pswRclass =hidden>您的密码不同< / p>
< input type =checkboxid =policyname =policyvalue =policy/> < label>我同意< / label>
< p id =checkNclass =hidden>您必须同意我们的< / p>

< input type =submitname =submitvalue =Login/>

< / form>

我尝试添加如下代码:

 < input type =emailname =emailinputid =emailinputvalue =<?php echo htmlspecialchars($ _ GET ['lastname']);?> ; /> 

但是,该行只显示在字段输入内。

解决方案

1)如果我没有错,在上面的代码中我没有看到任何带有name =lastname的字段。
$ b 2)使用$ _POST,因为您使用method =post发布表单数据。


I know there are lots others question like this and i found 1.000 answer on the web but none of those work with my code :( So can someone help me with how to keep email value after submit?

        <form name="login-registration" onSubmit="return validateForm()" method="post" action="" >
            <label>Email</label>
            <input type="email" name="emailinput" id="emailinput" value ="" />
            <p id="emptyEmail" class="hidden">Email field is required</p>
            <p id="invalidEmail" class="hidden">Email you insert is invalid!</p>
            <label>Your password</label>
            <input type="password" name="pswinput" id="pswinput" value=""/>
            <p id="pswMinMax" class="hidden">Password should be from 4 to 8 caracters</p>
            <p id="pswLettNum" class="hidden">Password should be letters and numbers. No special caracters are allow</p>
            <label>Repeat password</label>
            <input type="password" name="pswrepeatinput" id="pswrepeatinput" value="" onblur="isValidPswRep()"/>
            <p id="pswR" class="hidden">Your passwords is different</p>
            <input type="checkbox" id="policy" name="policy" value="policy" /> <label>I agree</label>
            <p id="checkN" class="hidden">You must agree to our term</p>

            <input type="submit" name="submit" value="Login" />

        </form>

I try to put some code like:

<input type="email" name="emailinput" id="emailinput" value = "<?php echo htmlspecialchars($_GET['lastname']); ?>" />

But that php line is just displayed inside the field input.

解决方案

1)If i am not wrong,i don't see any field with name="lastname" in your code above.

2)Use $_POST because you are posting your form data with method="post".

这篇关于提交后保留表单值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆