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

Passing values between ASP pages 2

Status
Not open for further replies.

EntLover

Programmer
Jan 7, 2003
6
CA
Hi, I am a total newbie to ASP & VBSCRIPT and I would like to know how to send data entered by the client to an asp page.

It has to be done inside a vbscript sub called by a button. I tried :
Sub mySub
windows.navigate "someASPpage.asp"
end sub

but I am not sure how to pass the info (textbox values) I need along. Any tips would be appreciated. Thanks in advance...
 
Usually textboxes are contained in a form. The form's action calls an asp page which reads the values from the request object...

htmlForm.htm

<form onSubmit=&quot;formHandler.asp&quot; method=&quot;post&quot;>
<input name=&quot;userName&quot;>
<input type=submit>
</form>


formHandler.asp
<%
inputName = request.form(&quot;userName&quot;)
response.write &quot;The user's name is &quot; & inputName
%>
Get the Best Answers! faq333-2924
&quot;A witty saying proves nothing.&quot; - Voltaire
mikewolf@tst-us.com
 
What if I need to send the same info to two different pages. Can I use post twice?
 
Um...you can only open one page at a time in a browser, how are you going to manage two pages?

To answer your question, no you can't submit a form to two pages simultaneously, but you could user Server.Transfer in the first page and transfer to the second page, thus still having access to all your form data that was being passed...
Or you could just include the second page at the bottom of the first (if for instance one was handling db submission and one was handling displaying something to the user).

-Tarwn ________________________________________________________________________________
Want to get great answers to your Tek-Tips questions? Have a look at faq333-2924
 
server.transfer? When will you cease to amaze me Tarwyn? Here's your star... Get the Best Answers! faq333-2924
&quot;A witty saying proves nothing.&quot; - Voltaire
mikewolf@tst-us.com
 
:) Thanks, and I hope not, the day I stop amazing you I will switch over to JSP or PHP ;)

Because that will be the day I know everything there is to know about VBScript and it will stop being fun.

-Tarwn ________________________________________________________________________________
Want to get great answers to your Tek-Tips questions? Have a look at faq333-2924
 
Thanks a lot for the info, I am learning more and more (the end of the tunnel is still very far tough :))

Would you guys know how to pass a value using &quot;windows.navigate&quot;. I saw an example like : document.location &quot;someASP.asp?Text=&Text&quot; but I can't seem to make it work with windows.navigate. Any ideas?

 
Ok, had to look that one up, but how about this:
Code:
<html>
<head>
<script language=&quot;VBScript&quot;>
<!--

window.navigate &quot;[URL unfurl="true"]http://www.google.com/search?hl=en&lr=&ie=UTF-8&oe=UTF-8&q=+site:www.tek-tips.com+tarwn&quot;[/URL]
//-->
</script>
</head>
<body>
</body>
</html>

If you wanted to link to one of your pages you could do this:
Code:
window.navigate &quot;mypage.asp?variable1=value1&var2=val2&var3=val3&quot;

then pull the values out on the asp page like so:
Dim myVariable1
myVariable1 = Request.QueryString(&quot;variable1&quot;)

Hope this helps,
-Tarwn ________________________________________________________________________________
Want to get great answers to your Tek-Tips questions? Have a look at faq333-2924
 
Exactly what I needed, and it works fine. Thanks a lot you made my day!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top