/    Sign up×
Community /Pin to ProfileBookmark

HELP! save session variable user_name to a form field

😡 I am brand new to writing code. With the help of MS code I found on the internet I was able to create a logon form in FrontPage. It has two fields that check user_name and password against an Access database1. If OK, it saves the user_name as a session variable and directs the person to a FrontPage password protected survey form (in otherwords, they must use the log on screen first). I have code that works great on the logon page that saves the session varaible as user_name. I also have code that makes the survey form greet the person to say “Welcome Joe Doe (what ever the session variable name is). The survey form has several form field questions that save back to database2 when you hit submit. But I can’t get the session variable user_name to save to a field to dump into the database!!!

I will have several different school districts logging in with their user_name and password and using the same survey. What I’d like to do is when they log in, save that session variable user_name to a form field called “district_name” which links and saves back to the database in a field called “district”. That way I will know by each record which district filled out the survey form.

What would the code be, where would I put this code (survey form) and what part: in the body, before <html ?

Things I’ve tried that didn’t work:

arFormFields0 (112) = Request(“District_Name”)
arFormDBFields0(112) = “District”
arFormValues0(112) = Session(“user_name”)

<% Session(“user_name”)=request.form (“district_name”) %> which did not work either

I tried this:

<%
If Len(Session(“user_name”)) <> 0 Then

Response.Write Request.form(“District_Name”)= Session(“user_name”)

End If
%>

that ends up putting the word “false” on screen like this and nothing in db: Princeton false School District, not in the text box.

I tried this & it didn’t work either

If Request.form(“District_Name”) = “” Then
FP_SaveFieldToDB fp_rs, (Request.form(“District_Name”)= session(“user_name”)), “District”
End If

HELP, HELP! I’m brand new to this & way over my head.

to post a comment
HTML

0Be the first to comment 😎

×

Success!

Help @swansonl spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...