Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/427.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用Javascript将表单数据存储到另一个页面的表中?_Javascript_Php_Html - Fatal编程技术网

如何使用Javascript将表单数据存储到另一个页面的表中?

如何使用Javascript将表单数据存储到另一个页面的表中?,javascript,php,html,Javascript,Php,Html,我需要使用javascript将表单数据从一个页面本地存储到表中的另一个页面 javascript代码是 function addtext() { var fname = document.myform.first_name.value; var lname = document.myform.last_name.value; var email = document.myform.email.value; do

我需要使用javascript将表单数据从一个页面本地存储到表中的另一个页面

javascript代码是

function addtext()
      {
         var fname = document.myform.first_name.value;
         var lname = document.myform.last_name.value;
         var email = document.myform.email.value;
         document.writeln("Thank you! You have just entered the following:");
         document.writeln("<pre>");
     document.writeln("<td>First Name :</td> " + fname);
         document.writeln("<td>Last Name :</td> " + lname);
         document.writeln("<td>Email Address :</td>  " + email);
    }
HTML部分是

var fname = document.myform.first_name.value;
     var lname = document.myform.last_name.value;
     var email = document.myform.email.value;
     document.writeln("Thank you! You have just entered the following:");
     document.writeln("<pre>");
 document.writeln("<td>First Name :</td> " + fname);
     document.writeln("<td>Last Name :</td> " + lname);
     document.writeln("<td>Email Address :</td>  " + email);

你为什么要这么做?有什么特别的原因吗?虽然不是最佳实践,但如果它的唯一用户首选项不是用户数据,那么通过javascript,您可以通过sessionStore或localStorage来实现

或者,如果cookie很好,那么使用jquerycookie

检查一下!附属的。希望对你有帮助

var fname = document.myform.first_name.value;
     var lname = document.myform.last_name.value;
     var email = document.myform.email.value;
     document.writeln("Thank you! You have just entered the following:");
     document.writeln("<pre>");
 document.writeln("<td>First Name :</td> " + fname);
     document.writeln("<td>Last Name :</td> " + lname);
     document.writeln("<td>Email Address :</td>  " + email);