简体   繁体   中英

Getting empty hidden values after form submit

I want to store some data on client side for that I create a JavaScript code, but, after form submit, i'm getting empty hidden field values. How to fix this?

 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;&nbsp;&nbsp;&nbsp; <input type='radio' name='jungle' value='GMAT'>GMAT&nbsp;&nbsp;&nbsp;&nbsp; <input type='radio' name='jungle' value='CAD'>CAD&nbsp;&nbsp;&nbsp;&nbsp; <input type='radio' name='jungle' value='MBA CET'>MBA CET&nbsp;&nbsp;&nbsp;&nbsp; <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>

The variable user expects a string type:

fid = 1100124686694263;
user = "Akshay Barpute";
document.getElementById('fid1').value = fid;
document.getElementById('user1').value = user;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM