Linking a Page & passing a variable using ASP & VB

Results 1 to 3 of 3

Thread: Linking a Page & passing a variable using ASP & VB

  1. #1
    CParks Guest

    Default Linking a Page & passing a variable using ASP & VB

    I am attempting to link a page and pass a variable using ASP and<BR>VBScript. I have attempted the code for linking the page, however have been unsuccessful. All I see is where the link is supposed to go when the mouse is over the button; nothing when it is clicked.<BR><BR>I don&#039t even know where to start to pass the variable from one page to another! The variable name is vartotal and it contains a number.<BR><BR>Below is a sample of my code for the button. Any suggestions on either problems is greatly appreciated!<BR><BR>&#060;html&#062;&#060;head&#06 2;<BR>&#060;title&#062;Reports2.asp&#060;/title&#062;<BR><BR>&#060;!--<BR>&#060;script language="VBScript"&#062;<BR>sub button1_OnClick<BR> document.location.href="//server/reports3.asp"<BR>end sub<BR>&#060;/script&#062;<BR>--&#062;<BR>&#060;/head&#062;&#060;body&#062;<BR>&#060;form action="Reports2.asp" method="POST"&#062;<BR>&#060;a href="Reports3.asp"&#062;<BR>&#060;input type="button" name="Button1" value="Continue"&#062;<BR>&#060;/a&#062;<BR>&#060;/form&#062;&#060;hr&#062;<BR><BR>&#060;/body&#062;&#060;/html&#062;<BR><BR><BR>

  2. #2
    Join Date
    Dec 1969
    Posts
    463

    Default RE: Linking a Page & passing a variable using ASP

    You should not be using an &#060;a href=&#062; tag in the form. You specify the page you wish to pass the variable to in the form action. Example: &#060;Form action="MyPage.asp" method="post"&#062;. To pass a variable you need to use a input type with a name value pair. For instance if you want the user to enter the value of myVariable you could place the &#060;Input type="text" Name="myVariable" value=""&#062; tag inside your form tags. If you want to supply the variable yourself with no input from the user you could use &#060;Input type="Hidden" Name="myVariable" value="2"&#062;.<BR>The basic priciple here is just passing name value pairs through a form with the action being the recieving page. Below is an example of a form which will pass text entered by the user and a value I supply to a page called page2.asp<BR><BR>&#060;Form action="Page2.asp" method="post"&#062;<BR> &#060;Input Type="text" Name="txtInput" value=""&#062; <BR> &#060;Input Type="hidden" Name="myNumber" value="9"&#062;<BR> &#060;input type="Submit" name="Submit" value="Submit"&#062;<BR>&#060;/form&#062;<BR> <BR><BR>

  3. #3
    CParks Guest

    Default RE: Linking a Page & passing a variable using ASP

    Changing the form action solved half of my problem. I&#039m still confused on how to make the variable that I created on the first page show up on the next page. Suggestions?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •