1

I have two HTML pages: firstpage.html and secondpage.html. In firstpage.html, there is a form- firstpage.html:

<!DOCTYPE html>
<html>
<head>
<title>Form Filling</title>
</head>
<body>
     <form action="secondpage.html" method="GET">
Enter Serial Number: <input type="number" name="serialNumber" />
                     <input type="submit" value="Submit" />
</form>
</body>
</html>

The firstpage data is sent to secondpage.html. I want to display and use the form data serialNumber in secondpage.html- secondpage.html:

<!DOCTYPE html>
<html>
<head>
     <title>Display</title>
</head>
<body>
<form name="selva" action="thirdpage.html">
  <input type="hidden" name="kumar">
</form>
<script type="text/javascript">
    var locate=window.location;
    document.selva.kumar.value=locate;
    var text=document.selva.kumar.value;
      function pass(str) 
      {
        point=str.lastIndexOf('=');
        return(str.substring(point+1,str.length));
      }
document.write("Serial Number" + pass(text));
</script>
</body>
</html>

So now I can pass the serialNumber variable from firstpage.html to secondpage.html so that the above code in secondpage.html will show the serial nuimber, and I want same serial number in at thirdpage- thirdpage.html:

<!DOCTYPE html>
<html>
<head>
   <title>Repeating</title>
</head>
<body>
<form method="link">
    Enter Serial Number2: <input type="number" name="burns" />
                         <input type="submit" value="Submit" />
</form>
</body>
</html>

please tell how to print a data in all those pages?

Prince Tegaton
  • 222
  • 1
  • 4
  • 14

1 Answers1

-2

The simplest method I could find for this is, write all the three pages in a single html file and display them based on conditions. This way you dont need to use localstorage.

Other method will be to use query parameters. You can simply learn how to use them. Here's the link to simple javascript-handled query params plugin:

http://jillix.github.io/url.js/

You can pass the serial no as a query parameter to another html. If you are confused on how to use this method, let me know and I'll tell you in detail.

Anshul Sanghi
  • 84
  • 2
  • 9