PDA

Click to See Complete Forum and Search --> : Beginner: Set Session while on same asp page


rlb_wpg
Apr 6th, 2001, 01:19 PM
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

PJB
Apr 6th, 2001, 01:43 PM
<form action = thisform.asp method=post>
etc

should do it:D

Cander
Apr 6th, 2001, 01:45 PM
also give you submit button a name then you can do this

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

'blah blah blah