passing form data to another HTML page

how to pass data from one page to another in html
passing form data between html pages
display html form values in another page after submit
passing form data to another html page using javascript
passing values between html pages
how to pass parameters in form action in html
how to pass value from one html page to another using jquery
how to pass json data from one html page to another

I have two HTML pages: form.html and display.html. In form.html, there is a form:

<form action="display.html">
    <input type="text" name="serialNumber" />
    <input type="submit" value="Submit" />
</form>

The form data is sent to display.html. I want to display and use the form data serialNumber in display.html, as shown below:

<body>
    <div id="write">
        <p>The serial number is: </p>
    </div>
    <script>
    function show() {
        document.getElementById("write").innerHTML = serialNumber;
    }
    </script>
</body>

So how can I pass the serialNumber variable from form.html to display.html so that the above code in display.html will show the serial number and the JavaScript function show() gets the serialNumber from the first HTML?

If you have no option to use server-side programming, such as PHP, you could use the query string, or GET parameters.

In the form, add a method="GET" attribute:

<form action="display.html" method="GET">
    <input type="text" name="serialNumber" />
    <input type="submit" value="Submit" />
</form>

When they submit this form, the user will be directed to an address which includes the serialNumber value as a parameter. Something like:

http://www.example.com/display.html?serialNumber=XYZ

You should then be able to parse the query string - which will contain the serialNumber parameter value - from JavaScript, using the window.location.search value:

// from display.html
document.getElementById("write").innerHTML = window.location.search; // you will have to parse
                                                                     // the query string to extract the
                                                                     // parameter you need

See also JavaScript query string.


The alternative is to store the values in cookies when the form is submit and read them out of the cookies again once the display.html page loads.

See also How to use JavaScript to fill a form on another page.

Sending parameters to another web page, This invisible form will pass to otherpage.html the parameter: varname=12345. 3) Extracting data received from the URL in the page. The location.search attribute  For sending data to two servelets make one button as a submit and the other as button.On first button send action in your form tag as normal, but on the other button call a JavaScript function here you have to submit a form with same field but to different servelets then write another form tag after first close.declare same textboxes there but with hidden attribute.now when you insert data in first form then insert it in another hidden form with some javascript code.Write one function for

You need the get the values from the query string (since you dont have a method set, your using GET by default)

use the following tutorial.

http://papermashup.com/read-url-get-variables-withjavascript/

function getUrlVars() {
    var vars = {};
    var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {
        vars[key] = value;
    });
    return vars;
}

Sending form data, You can also use a database and PHP, if you need to store the data permanently (remember that the user can always clear its cookies). What you will have to do  Passing PHP form variables from one page to other This is in continuation of the PHP multi-page order form article. The first paged explained how to pass the variables between pages using sessions.

Use "Get" Method to send the value of a particular field through the browser:

<form action="display.html" method="GET">
    <input type="text" name="serialNumber" />
    <input type="submit" value="Submit" />
</form>

How to pass HTML form input value to another HTML page which , Hey guys, Learn how to transfer data one page to another page with a GET and Post method Duration: 2:27 Posted: Jun 21, 2017 <form action="param-received.html" method="GET"> various widgets </form> See at the source of the form at bottom. The GET method appends the data to the URL, while the POST method would transmit them directly. Sending data without form. To pass parameters to another page or a script without displaying a form (but with a form tag), we use the "hidden" field:

<form action="display.html" method="post">
    <input type="text" name="serialNumber" />
    <input type="submit" value="Submit" />
</form>

How to pass variable one page to another page or same page, In this tutorial we are going to look at passing a value from one HTML page to another. We Duration: 17:06 Posted: Feb 27, 2019 Usually, we can pass the data from one page to another page as a parameter in the URL. Passing those values in URL has certain disadvantages. If the data is too big, URL with long string doesn’t look good. Displaying important data in the URL to the user can be harmful to your data security. Another way is to use the POST method.

If your situation is as described; You have to send action to a different servelet from a single form and you have two submit buttons and you want to send each submit button to different pages,then your easiest answer is here.

For sending data to two servelets make one button as a submit and the other as button.On first button send action in your form tag as normal, but on the other button call a JavaScript function here you have to submit a form with same field but to different servelets then write another form tag after first close.declare same textboxes there but with hidden attribute.now when you insert data in first form then insert it in another hidden form with some javascript code.Write one function for the second button which submits the second form. Then when you click submit button it will perform the action in first form, if you click on button it will call function to submit second form with its action. Now your second form will be called to second servlet.

Here you can call two serveltes from the same html or jsp page with some mixed code of javascript

An EXAMPLE of second hidden form

<form class="form-horizontal" method="post" action="IPDBILLING" id="MyForm" role="form">
    <input type="hidden" class="form-control" name="admno" id="ipdId" value="">
</form>
<script type="text/javascript">
    function Print() {
        document.getElementById("MyForm").submit();
    }
</script>  

JavaScript Problem: Passing a JavaScript Value Between HTML , The method attribute specifies how to send form-data (the form-data is sent to the page specified in the action attribute). The form-data can be sent as URL variables (with method="get") or as HTTP post transaction (with method="post"). Notes on GET: Appends form-data into the URL in name/value pairs. I'm fairly new at this. I'm trying to build a store locator and trying to figure out how to pass an input value from one page to another page. User would input their zipcode or address in a form

HTML form method Attribute, Passing data from a form on one page to another form on another page .​blogspot.com/2009/09/get-url-parameters-values-with-jquery.html. To pass data between fragments you need to pass the data in the object constructor. To make passage of data from one fragment to another possible, we need to obtain view model object with activity scope in both fragments.

Passing data from a form on one page to another form on another , I want to pass a value from an html page to another html page. Is there any methods to pass the value in html code or javascript code? I am not 

Passing values from HTML to HTML page, User A makes a choice on one page and then goes to another. Let me start by showing you the code that made the small form just above: Hello, I need to pass data from my form to a form that has matching values on another website, 

Comments
  • you need to use a server side language. for example, PHP
  • @Eric: I can't run PHP since I'm writing mobile web apps. So I can only use HTML and JavaScript.
  • @tonga Why can't you use a server-side technology? "because you're writing mobile web apps" isn't really an answer. Any app that can be viewed on a mobile browser is still just a web app, hosted by a server. Do you have hosting restrictions that don't permit the use of dynamic page languages?
  • @Peter: My mobile app is a local app. So it does not connect to any web server. That's why I can't use a server-side technology.
  • Ok, that's helpful to know. You might consider stating this in the question.
  • @tonga See How can I get query string values for examples and methods of processing the query-string.
  • @Boaz: Thanks. I'll take a look and try.
  • @tonga Edited a couple of minutes ago. Try reloading.
  • @tonga - I'm not sure they will, but you should just try and see if it works. If it doesn't use cookies and check out the second question I linked to. Cookies should work, but they can be messier since they have a longer lifespan than query string parameters.
  • @Richard: I just retried it and finally it works on my phone. I think something was messed up so I didn't see the parsed query string initially. Thanks a lot.
  • that code is causing a browser error for me! Your file was not found
  • This answer is for java supported servers. But the question is only html.