[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 214
  • Last Modified:

insert session 'hidden variable' into access table - problem

I have a form which has a hidden variable insertion  into an access database table. The hidden variable is a session variable, created via the login process. The form and action pages work, but I do not get the session value inserted into the web_name field. I get #Session.web_name# instead.

Would really appreciate some help

Heres what I have got

FORM
<input name="web_name" type="hidden" id="web_name" value="#Session.web_name#"> where web_name is the name of the session variable and also the name of the field in the database table.

ACTION

the field name is correctly inserted into the INSERT INTO wearer_measur.... section

this is the related cfif statement for the INSERT INTO  above
<cfif IsDefined("FORM.web_name") AND #FORM.web_name# NEQ "">
    '#FORM.web_name#'
    <cfelse>
    NULL
  </cfif>


many thanks in advance
0
jameskane
Asked:
jameskane
  • 2
  • 2
1 Solution
 
erikTsomikSystem Architect, CF programmer Commented:
<cfparam name="session.web_name" default=""> in your action and also check to make sure that you use '#session.web_name#'
0
 
_agx_Commented:
You need to use <cfoutput> tags around the form field so CF evaluates the value of the variable.

<cfoutput>
<input name="web_name" type="hidden" id="web_name" value="#Session.web_name#">
</cfoutput>
0
 
jameskaneAuthor Commented:
Well, thats all sorted out now. There were in fact two problems. Firstly, as you noted agx. And secondly there was the problem that the session variable was stored as Session.MM_Username and not web_name as I had assumed in my confused state !

erikTsomik:could you say a little more about your point - I dont fully understand.

THANKS to you both !
0
 
erikTsomikSystem Architect, CF programmer Commented:
Well before it goes to the action page make sure the session is exist so just check it  IsDefined ("")
0
 
jameskaneAuthor Commented:
ok, understand, thanks erik

james
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now