Passing a parameter (Full Version)

All Forums >> [Web Development] >> ASP and Database



Message


markjlawrence -> Passing a parameter (3/28/2001 16:03:00)

Hi,

I have a login form which posts an account number to a second form where I show some statistics based on that account number from a database using the DRW.

From this form, I would like to post this account number on to a third page. I have tried using hyperlinks with parameters i.e. <%=account%> (please don't laugh. I'm pretty sure the syntax is well of the mark here). Just can't figure out how to reference this value which was posted from a previous page.

I can use the DRW to query the account number against a table and display the result as a text field which can I can then submit. However, I'm sure that this is an unnessecary step.

Can anyone help?

Mark.





Vince from Spain -> RE: Passing a parameter (3/28/2001 16:49:00)

Hi Mark,
I think this URL might give you the information that you need . . .
http://www.outfront.net/spooky/hyper_param.htm

Vince

------------------
Internet Business Solutions S.L.(Spain)





markjlawrence -> RE: Passing a parameter (3/28/2001 17:14:00)

Hi Vince,

I posted this reply to a posting made by 'thebridge' about passing parameters. His problem was identical to mine. Here is the reply that I posted:

Hi Vince,
I think you could well have sorted my worry's with this one.

Thebridge had exactly the same problem as myself. In one of your replies, you said to create a form with a username and password, then have it post to itself. Is there a way to use the DRW to check that it exists?

If so, how do you set the session variable assuming that it exists?

Thanks

Mark.





Vince from Spain -> RE: Passing a parameter (3/28/2001 17:39:00)

Ok Mark,
reading through once again I think I may have more of an idea what you want to do. (Correct me if I am wrong . . . )

You post the account number from the login page, and want to use that on a third page no? But, you don't know how to carry this account number onto that third page except by using a text "input" field. I think what you need here is a "hidden" input field. For instance, in the form of your second page . . .
<form etc, etc>
<input type="hidden" name="account" value="<%=Request.Form("account") %>">
</form>

If the information comes from the first page as part of the URL, then the Request.Form would be Request.QueryString

If, instead of a form, you want to pass the account number to the third page as part of the URL, use something like this . . .

<a href="thirdpage.asp?account=<%=Request.Form("account") %>">third page line</a>

These 2 methods of passing parameters are knows as POST (when using forms) and GET (when using URL parameters).

Session variables are another way of passing parameters between pages, but, they should be used as sparingly as possible. If you should ever decide that you have to use them, the syntax is like this . . .

<% Session("sessionvariablename") = "anexamplevalue" %>

to set them, and . . .

<% Response.Write Session("sessionvariablename") %>

To use them. I just used Response.Write to illustrate how they can be used.

I hope this is nearer the mark, and makes some kind of sense

All the best

Vince

------------------
Internet Business Solutions S.L.(Spain)





markjlawrence -> RE: Passing a parameter (3/29/2001 23:49:00)

Thanks Vince,

Maybe it would help if I explained what I would like to do rather than how I think I should do it!


1. login.asp contains a form with 2 fields for the user to enter their account number and password. I want these to be checked against my customer.mdb to make sure that they exist before sending them on to members.asp.

2. I need members.asp to only allow users existing in the database to enter. Their account number also needs to be available (perhaps as a session variable or hidden field as you mentioned). This value then needs to be available to use in a form query on the members.asp page so that they can view other tables. The other tables each have a field called 'account'. This is so I can filter them and display records relating to them.

Does this make sense? One of my other problems is that I have been using the DRW until now and have never created the connection myself, so would love to be able to do this using the DRW.

Thanks for all your help. I am surprised that you and spooky have time to run your own businesses when you have to answer daft questions from people like me!

... Do you have a tutorial anywhere that shows how to create a connection to a database without the DRW. I am starting to outgrow the DRW already!

Mark.





Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
6.298828E-02