Click to See Complete Forum and Search --> : How to pass parameters in ASP


chandima
01-26-2003, 02:37 AM
Hi,
I'm new to ASP. I want to do what below page1.html does in ASP. The reason why I want to do in ASP is that, I will be able to loop though multiple cust_ids'(for example, cust_id=2, cust_id=3, etc) and read the multiple responses which below html can not do. As a first step, I want to know how to do in ASP what exactly below html does.

I tried below page1.asp code, it does not seem to work.(I haven't implemented multiple cust_id yet)

Any help will be appreciated

Thanks,
Chandi


page1.html
<form name="account_details"
action="http://localhost/test/page1.asp?cust_id=1"
method="post">

<table border="0">
<tr>
<td><div align="right"> User Name : </div></td>
<td><input name="username" type="text" value="abc" > </td>
</tr>
<tr>
<td><div align="right"> Password: </div></td>
<td><input name="password" type="password" value="123"> </td>
</tr>
<tr>
<td colspan="2"><div align="center">
<input name="Submit" type="submit" value="Login">
</div></td>
</tr>
</table>



page1.asp
<%
'Response.Cookies("username")="abc"
'Response.Cookies("password")="123"

Session("username")="abc"
Session("password")="123"

Response.Redirect "http://localhost/test/page2.asp?cust_id=1"

%>

Ribeyed
01-26-2003, 04:21 AM
ok you almost have it there. You just need to request the values from the form on you second page.

<%

'fisrt you request the information from the form or querystring


cust_id = request.querystring("cust_id")
Username = request.form("username")
password = request.form("password")

%>
notice that i use "request.querstring" for the cust_id and "request.form" for the others. Cust_id is being passed in the querrystring.

The rest of the code should work.