moving from one page to another

Posted on 2004-11-29
Medium Priority
Last Modified: 2013-12-24
i have a input page which has a form with a listbox,two textboxes and a submit button.After users selecting a value from the listbox , typing values in the textboxes and submitting it, i have to insert those values into the database and then moveup to the next page,the actions page.how to use those form variables in the next page (which also has a form) for inserting into the database?
i inserted these values into the database in the input form and used <cflocation url="actions.cfm"> at the end  to go to the next page, but it shows error.What can be done to this ?

Question by:jaiswalpragya
LVL 35

Expert Comment

ID: 12700682
what is the error?
LVL 17

Expert Comment

ID: 12701521
..... .... .. .......... ...... ....... .... (scanning) ... ........ .. ..... ... . .. .  (scanning)... ...

I'm trying to scan your brain waves to see what the error is, but I can't seem to get a hold on your brain waves!!

In all seriousness, we need to see some errors before we can comment how else do we know what is wrong?

We can guess:

- It could be that the action page expects the form variables, which are lost when you do a cflocation
- There could be a db error
- You could refer to a wrong variable name
- etc. etc.

Accepted Solution

aftershox earned 1500 total points
ID: 12702058
When you do a CFLOCATION you won't be passing the variables along with it. So I'm guessing that's why the final page is bombing because it expects those variables to exist.

The easiest thing to do is pass the variables via URL onto the final page. Eg:

<CFLOCATION URL="actions.cfm?Var1=Value1&Var2=Value2">

The second easiest way would be instead of cflocation to build an html page with a hidden form that submits on load. Eg:

<body OnLoad="document.form.submit()">

<form action="actions.cfm">
  <input type="hidden" name="Field1" value="#FORM.Field1#">
  <input type="hidden" name="Field2" value="#FORM.Field2#">
  <input type="hidden" name="Field3" value="#FORM.Field3#">

- Tariq Ahmed. tariq@dopejam.com
LVL 17

Expert Comment

ID: 12702210
I did the same guessing work already...

Expert Comment

ID: 12706744
To put these forms in the database you should use something like this:

<form action="page2.cfm">
<input type=text name=var1>
<input type=submit>

<cfquery datasource="myDsn" name="example">
INSERT INTO tblName (field1) VALUES ('#form.var1#')
<form action="action.cfm">
<input type=text name=var1 value="#var1#">
<input type=submit>

thanks! blabla..
<cfquery datasource="myDsn" name="example">
UPDATE tblName SET field1='#form.var1#'

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A web service (http://en.wikipedia.org/wiki/Web_service) is a software related technology that facilitates machine-to-machine interaction over a network. This article helps beginners in creating and consuming a web service using the ColdFusion Ma…
What You Need to Know when Searching for a Webhost Provider
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question