Hi,
I am currently having so many problems with passing text fields to the next page, but I only want the entered fields to be displayed on the next page. So far I have been able to pass 1 text field to another page, in the text box format, but as soon as I try and pass multiple fields, it doesn't seem to work. Here's my code so far:
The first page (form):
<html>
<head>
<title>Pass variables with javascript</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<br>
<br>
<h3><font color="#000066">Pass variables in URL string with javascript:</font></h3>
<br>
<br>
<form method="get" action="nextpage.html">
<p>
<input type="checkbox" name="checkbox1">
<input type="text" name="myvar">
</p>
<p>
<input type="checkbox" name="checkbox2">
<input type="text" name="myvar2">
</p>
<p>
<input type=submit>
</p>
</form>
</body>
</html>
and the next page:
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<br>
<br>
<h3> variable passed</h3>
<br>
<br>
<script>
twdlength = window.location.search.length
myvar=window.location.search.substring(7,twdlength);
</script>
<form name="whatever">
<input type="text" name="newvar" value="myvar">
</form>
</body>
<script>
document.forms["whatever"].newvar.value = myvar;
</script>
</html>
In the first page, I have changed the form so that it has 2 text fields and 2 checkboxes next to them. The second page works at the moment, but only for 1 input text field. I basically need to carry over and display the text fields that have only been entered into, and leave out the ones that do not have entries.
How can I achieve this? Thank you so much.
I am currently having so many problems with passing text fields to the next page, but I only want the entered fields to be displayed on the next page. So far I have been able to pass 1 text field to another page, in the text box format, but as soon as I try and pass multiple fields, it doesn't seem to work. Here's my code so far:
The first page (form):
<html>
<head>
<title>Pass variables with javascript</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<br>
<br>
<h3><font color="#000066">Pass variables in URL string with javascript:</font></h3>
<br>
<br>
<form method="get" action="nextpage.html">
<p>
<input type="checkbox" name="checkbox1">
<input type="text" name="myvar">
</p>
<p>
<input type="checkbox" name="checkbox2">
<input type="text" name="myvar2">
</p>
<p>
<input type=submit>
</p>
</form>
</body>
</html>
and the next page:
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<br>
<br>
<h3> variable passed</h3>
<br>
<br>
<script>
twdlength = window.location.search.length
myvar=window.location.search.substring(7,twdlength);
</script>
<form name="whatever">
<input type="text" name="newvar" value="myvar">
</form>
</body>
<script>
document.forms["whatever"].newvar.value = myvar;
</script>
</html>
In the first page, I have changed the form so that it has 2 text fields and 2 checkboxes next to them. The second page works at the moment, but only for 1 input text field. I basically need to carry over and display the text fields that have only been entered into, and leave out the ones that do not have entries.
How can I achieve this? Thank you so much.