Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to save my variable from html page

Status
Not open for further replies.

H1004

MIS
Oct 28, 2003
136
US
I have an html page with form that ask the users for unit# & password. Let's call this page htmlPg1. After I submit this htmlPg1 page, it would go to another html page called htmlPage2 & ask for more criteria. However, I want save unit# and password in a variable & hopefully carry it to another page htmlpage3.
Here is my code:

htmlPg1
<html>

<head>
<SCRIPT LANGUAGE="JavaScript">
<!--

function locate()
{
location=" }
// End -->

</SCRIPT>
</head>

<body bgcolor="#008080" text="#FFFFFF">
<form action= "htmlPg2.html">
<p> Account Unit:
<select name= "UNIT">
<option value="12001">12001 </option>
<option value="12002">12002 </option>
<option value="12003">12003 </option>
<option value="12004">12004 </option>
<option value="12005">12005 </option>
<option value="12997">12997 </option>
<option value="13510">13510 </option>
<option value="13520">13520 </option>
<option value="13600">13600 </option>
<option value="15001">15501 </option>
<option value="15502">15502 </option>
<option value="15504">15504 </option>
<option value="15505">15505 </option>
<option value="15506">15506 </option>
<option value="15510">15510 </option>
<option value="15508">15508 </option>
<option value="15509">15509 </option>
</select><br>
<p> Password:
<input type="password" name="PASSWORD" size="10">
<input type="submit" name="submit" onClick="javascript:locate();">
</form>

</html>


Now my htmlPg2


<html>

<head>
<SCRIPT LANGUAGE="JavaScript">
<!--

function locate()
{
location=" }
// End -->

</SCRIPT>
</head>

<body bgcolor="#008080" text="#FFFFFF">
<form action= "htmlPg3.html">
<p> Month:
<select size="1" name="MONTH" >
<option value="1">JAN</option>
<option value="2">FEB</option>
<option value="3">MAR</option>
<option value="4">APR</option>
<option value="5">MAY</option>
<option value="6">JUN</option>
<option value="7">JUL</option>
<option value="8">AUG</option>
<option value="9">SEP</option>
<option value="10">OCT</option>
<option value="11">NOV</option>
<option value="12">DEC</option>
</select><br>
<p> Year:
<select size="1" name="YEAR" >
<option selected value="2004">2004</option>
</select><br>
<p> Format:
<select size="1" name="WFMT">
<option value="PDF">PDF</option>
<option value="EXL2K">EXCEL</option>
<option value="HTML" selected>HTML</option>
</select>
<input type="submit" name="submit" onClick="javascript:locate();">
</form>

</html>

Basically, how can I store the unit & password to be used in htmlPg3. Please help.
 
I know this is a forum for helping each other and I am always happy to do that, but I feel obliged to point out that this is really basic form and variable stuff that is widely available on the web with minimal research.

Having said that, here is the solution :eek:)

In htmlpg2 you grab the form variables from htmlpg1 and stick them into a hidden form variable

Code:
<input type="hidden" name="unit" value="<%=request.form("unit")%>">
<input type="hidden" name="password" value="<%=request.form("password")%>">
then in htmlpg3 you grab the form value in the normal way.

An alternative is to pass it via a querystring
Code:
<form action="htmlpg3.asp?unit=<%=request.form("unit")%>&password=<%=request.form("password")%>">
then grab from querystring in page 3

Where you are going to find a problem is submitting to htmlpg3.HTML from the form rather than .ASP - or you could do it in Javascript, but why would you be asking in the ASP forum?

Hope that helps

Steve Davis
hey.you AT HaHaHa.com.au

Me? I can't even spell ASP!

NOTE: This sig does not include any reference to voting, stars, or marking posts as helpful as doing so is cause for membership termination
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top