Results 1 to 3 of 3

Thread: Beginner: Set Session while on same asp page

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 2000
    Location
    Canada
    Posts
    70
    I'm brand new to asp so bear with me.

    I have an asp page with a text box, a pulldown list and a 'submit' button.
    I'd like to set session values using the submit button without going to another file.
    For example,
    ...
    <HEAD><SCRIPT LANGUAGE="JavaScript"><!-- Begin
    function SubmitInfo() {
    var msg
    <%
    Session("Name")=request("Name")
    Session("UseDb")= request("useDB")
    msg = session("UseDb")
    %>
    window.alert("Database selected: " + msg);
    }
    // End --></SCRIPT></HEAD>
    ...
    <form name="EnterInfo">
    <B>Name: &nbsp</B><input type="text" name="name" size=8><BR>
    <SELECT NAME="UseDb" STYLE="Height: 24px; Width: 75px">
    <OPTION VALUE="SwitchDbCops2">Cops 2
    <OPTION VALUE="SwitchDbCops1">Cops 1
    </SELECT>
    <input type="submit" value="Save Info" onClick="SubmitInfo();">
    </form>
    ...

    The above does not work (I assume because it can't request itself).
    Does anyone know how I could modify this so it could work.
    Either Javascript or VBscript is fine with me.

    Thanks in advance,
    rlb_wpg

  2. #2
    Hyperactive Member PJB's Avatar
    Join Date
    Aug 2000
    Location
    dunno at the moment
    Posts
    302

    try this

    <form action = thisform.asp method=post>
    etc

    should do it
    VB6.0 SP4
    Windows 2000
    I'm thinking of a number between

  3. #3
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    also give you submit button a name then you can do this

    If request.form("Submitbuttonsname") = "Save Info" then

    'blah blah blah
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

Posting Permissions

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



Click Here to Expand Forum to Full Width