www.webdeveloper.com
Results 1 to 2 of 2

Thread: How to pass parameters in ASP

  1. #1
    Join Date
    Jan 2003
    Posts
    3

    How to pass parameters in ASP

    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"

    %>

  2. #2
    Join Date
    Jan 2003
    Location
    Dundee, Scotland
    Posts
    1,367
    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.
    ----------------------------------

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles