简体   繁体   中英

After clicking submit button the details entered by user has to be shown in another registration form

I created a HTML Registration page using HTML5 and Javascript its worked but after clicking submit button i have to show the details entered by the user in the another registration form (which is hidden on the same page before clicking submit button). once u have clicked submit button then that registration form has to be shown and the details which we entered also has to be shown.

If you have in first page fields with name "field1", "field2", "field3" etc like -

<form action='page2.html'>
<input type='text' name='field1'> 
<input type=submit>
</form>

In page2.html, get the parameters of GET request by javascript.
You can print the form values by using the function get(parameter) like - get("field1");

    <script>
function get(name){
   if(name=(new RegExp('[?&]'+encodeURIComponent(name)+'=([^&]*)')).exec(location.search))
      return decodeURIComponent(name[1]);
}
</script>
In page1, you entered
<script>
 document.write(get("field1"));
</script>

You can see it working here
But it is always better to use server side programing like php jsp asp etc. if you want to keep record for the fields and use it

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