我想在客户端存储一些数据,因为我创建了一个JavaScript代码,但是,在表单提交后,我得到了空的隐藏字段值。如何解决这个问题?
fid = 1100124686694263;
user = Akshay Barpute;
document.getElementById('fid1').value = fid;
document.getElementById('user1').value = user;
Welcome Fill below information to setup your account</br>
<form action='fb1.php' method='post'>
Enter your email:
<input type='email' name='emailid'>
</br>
Select examination:
<input type='radio' name='jungle' value='GRE'>GRE& nbsp;
<input type='radio' name='jungle' value='GMAT'>GMAT
<input type='radio' name='jungle' value='CAD'>CAD
<input type='radio' name='jungle' value='MBA CET'>MBA CET
<input type='radio' name='jungle' value='others'>others(includes bank & it company exams)
<br>
<input type='hidden' name='fid' id='fid1' value=''>
<input type='hidden' name='user' id='user1' value=''>
<input type='submit' name='sub' value='Submit'>
</form>
答案 0 :(得分:1)
变量user
需要字符串类型:
fid = 1100124686694263;
user = "Akshay Barpute";
document.getElementById('fid1').value = fid;
document.getElementById('user1').value = user;