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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to pass values to asp page?

Status
Not open for further replies.

choohean

Technical User
Jan 15, 2002
57
MY
I wanted to pass a values which is a integer to asp page so that I will know how many records that I have to run the insert queries... Can any one please give me a hand?
 
The values is actually inside the javascript of first page..
 
You want to submit the first page from javascript to another asp page passing a integer value to the second one?

If this is the case then:

function send(){
var x = 2;
document.frmMain.action = 'second.asp?Val='+x document.frmMain.method = 'POST';
document.frmMain.submit();
}

Regards,
Durug
 
But than how to get the values from the second page?
 
In my post the line was split:
you should read
document.frmMain.action = 'second.asp?Val='+x

You mean:
"But than how to get the values on the second page?"
If yes then like this:
if x =2 in your javascript function on the second page you have to write:
<%
valueneeded = request.QueryString(&quot;Val&quot;)
%>
Then valueneeded = 2

Durug
 
Very sorry...I'm very new beginner...So, I actually don't know how to place the code...

And I have actually try it it comes out:invalid character!

can you please teach me how to use it?

regards, eddy
 
First page first.asp

<html>
<body>
<form action=second.asp method=post name=frmmain>
<input type=text name=value>
<input type=submit value=submit>
</form>
</body>
</html>

Second page second.asp

<html>
<body>
<%
Response.write request.form(&quot;value&quot;)
%>
</body>
</html>

On the second page it will display the value that you enter in the input box on the first page after you click the submit button


With javascript:

First page first.asp

<html>
<head>
<script language=javascript>
function gonext()
{
var x = 2;
document.frmMain.action = 'second.asp?Hip='+x;
document.frmMain.method = 'POST';
document.frmMain.submit();
}
</script>
</head>
<body>
<form action=second.asp method=post name=frmmain>
<input type=text name=value>
<input type=button value=submit onclick='gonext();'>
</form>
</body>
</html>

Second page second.asp

<html>
<body>
<%
Response.write request.querystring(&quot;Hip&quot;) & &quot;<hr>&quot;
Response.write request.form(&quot;value&quot;)
%>
</body>
</html>

It will read on the first line after the &quot;<%&quot; sign the value from javascript and on the second line the value from the input box

Of course you will have to have IIS installed, copied the asp files under c:\inetpub\ and call them with

Regards,
Durug
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top