S

  • Thread starter Thread starter Stephen Green
  • Start date Start date
S

Stephen Green

I currently have a page on which I have a FP form that submits to a
database - it works. What I'd like to do is capture some of that form data
into session variables for use on other pages.

I tried placing code like this - <% session("variablename") =
request.form("fieldname")%> - just before the </form> tag. Nothing. I tired
right after the </form> tag. Nothing.

Is what I'm trying to do possible? Is my notion of the code wrong?

Thanks and Happy New Year.

Stephen
 
Yes it is possible, but the code has to go into the page that the form
submits to. If it is the same page as the form, then it does not matter
(within limits) where the code goes.
 
Thanks, Ron!

Since the form submits to a database, would I place the code in the
confirmation page?

Thanks again and Happy New Year!

Stephen
 
The page will submit to an .asp page, which will update the database.
This page may be the confirmation page, the form page or a third page.

Preview the form page in a browser, view source, and see which page is
linked by the form action.

example: <form action="update.asp" ...

The code goes in that page.
 
Ron!

The code looks like this:

<form method="POST" action="--WEBBOT-SELF--">

I does post to the database, however. Can I change the action to be a file
name (like the confirmation page I created. Then the variables would be
available there...

Thanks.

Stephen
 
That is the code in FrontPage code view. You *must* look at the page,
running on a server, in a browser. When the page is saved/published to a
server the action="webbot-self" is changed to an actual page name. Example,
in new.asp in the DIW it is changed to action="new.asp"

On checking the code used in the various pages of FP's DIW, it is likely
your page submits to itself.

taking new.asp as an example, the asp code cannot be edited, but can be
added to.
Just before the <html> tag (in fact, almost anywhere after the code FP has
put in), add

<%
If Request.ServerVariables("REQUEST_METHOD") = "POST" Then
If Request.Form("VTI-GROUP") = "0" Then
session("variablename") = request.form("fieldname")
end if
end if
%>


The first two lines can be copied and pasted from the existing code, and are
there to prevent the session variable being created before the page is
submitted.
The above code will work on that page, you will have to adapt it for any
other pages.

If your page is very different, post the code.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top