1
Guys I have a big problem, I’ve researched a lot and I couldn’t solve my problem. I hope you can help me!
I have a page (in html) with a form. I would like the value placed in the input of the first form, when clicking Submit, to be placed in the input value of the second form automatically.
This is the first code from the first page. I took this code from a question here in the gringa overflow.
<html>
<head>
<form action="display.html" method="GET">
<input type="text" name="serialNumber" />
<input type="submit" value="Submit" />
</form>
</body>
</html>
The second page would be this:
<html>
<head>
</head>
<body>
<div id="write">
<p>O valor é: </p>
</div>
<script>
// from display.html
document.getElementById("write").innerHTML = window.location.search; // you will have to parse
// the query string to extract the
// parameter you need
</script>
</body>
</html>
It works, but the problem is that I would like the value of the first input to be put in the same way, on the second page, I just can’t fit the codes.
To get the id="write"
inside, to happen what I’m trying to do.
<input type="text" name="serialNumber" />
Thank you guys, I know this is a very nice community, even without signing up, I already found answer to all my questions with you!
What you’ve tried and what mistake happened?
– Ricardo
I did not find anything specific to solve what I need, php for me is very confusing yet, I could not make it work!
– Gabriel Mattoso
Ever tried to use
session
?– Amanda Lima
Guys, I edited the question, now I think it will be more understandable my question.
– Gabriel Mattoso
@Gabrielmattoso give more details, please. Do you use any server-side language (php, nodejs, C#) to process this data? You want to do only on the client side (browser, with javascript and html)?
– Wallace Maxters
Only with Javascript and Html, the data will be processed in the second form with an autoresponder, I just want to pass the name of a superficial form to the other of the autoresponde, where la the person himself will complete the data and send.
– Gabriel Mattoso
Since it is a GET request, the parameter will be in the url. On its second page, extract the value of the parameter in the url, this question can help.
– Renan Gomes
I’ll take a look at the question Renan, thanks man!!
– Gabriel Mattoso