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!

Variable's questions

Status
Not open for further replies.

ChuckG

MIS
Feb 28, 2001
211
US
I'm just starting to use SQL and database calls on a web site I'm working on. I'm not too familar with how HTML/ASP handles them. Are there any web sites that show some examples of variable usage?

Right now my problem is simply, I've got a form on an ASP page that the user selects the line (in the table) that they want to modify.
Once they select it, the next ASP page displays the current values of the record they selected and has form fields to allow them to modify some of these fields.

The problem is I don't see how to pass the value from the form on the 1st page to the 2nd page without making the users type the line number in again.

Thanks for any help.
 
if you are using <a href> to call the next asp page, try this:

<a href=&quot;nextpage.asp?var1=<%=var1%>&var2=<%=var2%>&quot;>

if var1 = 1 and var2 = 2 then the address to nextpage.asp will look like this

http:\\...\nextpage.asp?var1=1&var2=2

then in the nextpage.asp source code to get those values you do this:

<%
var1 = Request.QueryString(&quot;var1&quot;)
var2 = Request.QueryString(&quot;var2&quot;)
%>

Now you can use those values in the nextpage.asp
 
I'm using a form to call the next page up, using POST.

It's getting pretty complicated and what I'd like to do is simplify it a bit.

At the moment to modify a entry from the table they go to asp page #1 which lists the table out, and gives them a 1 line form field to select their line number and submit, which goes to asp page #2 which shows the detail from the record they select and form fields to change certain fields (and I'm forced to make them type the line number again) then they submit to asp page #3 which actually processes the changes and forwards them back to the main page.
 
so try using instead of sending the variables through the address string you should use:

page1:
<form name=&quot;form1&quot; action=&quot;page2.asp&quot; method=&quot;post&quot;>
<input type=&quot;hidden&quot; name=&quot;var1&quot; value=&quot;<%=var1%>&quot;>
<input type=&quot;hidden&quot; name=&quot;var2&quot; value=&quot;<%=var2%>&quot;>
<input type=&quot;hidden&quot; name=&quot;var3&quot; value=&quot;<%=var3%>&quot;>
</form>

page2:
<%
var1 = Request.form(&quot;var1&quot;)
var2 = Request.form(&quot;var2&quot;)
var3 = Request.form(&quot;var3&quot;)
%>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top