Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing data to process

Status
Not open for further replies.

liark

Programmer
Apr 18, 2000
36
GB
I have gathered all the data from various sources.

Do I need to create a form like this to write it, or is there a better way:

<cfoutput>
<form action=&quot;write.cfm&quot; method=&quot;POST&quot;>
<input type=&quot;Hidden&quot; name=&quot;data1&quot; value=&quot;#data1#&quot;>
<input type=&quot;Hidden&quot; name=&quot;data2&quot; value=&quot;#data2#&quot;>
<input type=&quot;Hidden&quot; name=&quot;data3&quot; value=&quot;#data3#&quot;>
<input type=&quot;Hidden&quot; name=&quot;data4&quot; value=&quot;#data4#&quot;>
<input type=&quot;Hidden&quot; name=&quot;data5&quot; value=&quot;#data5#&quot;>
<input type=&quot;Hidden&quot; name=&quot;data6&quot; value=&quot;#data6#&quot;>
<input type=&quot;Hidden&quot; name=&quot;data7&quot; value=&quot;#data7#&quot;>
<input type=&quot;Hidden&quot; name=&quot;data8&quot; value=&quot;#data8#&quot;>
<input type=&quot;Submit&quot; value=&quot;Create Record&quot;>
</form>
</cfoutput>

The reason I don't want to do it like this is because of the submit button. I want to drop through this page without stopping. I don't think I can use url variables.

Any ideas? Thanks

Liark
mark@liark.com
 
Hey Liark,

If you want this page to simply go to the next page in the process automatically, I would try something like this:

<cflocation
url=&quot;write.cfm?data1=#urlencodedformat(data1)#&data2=#urlencodedformat(data2)#&data3=#urlencodedformat(data3)#......&data8=#urlencodedformat(data8)#&quot;

addToken=&quot;no&quot;
>

The only problem with this is that some earlier browsers didn't handle very long url strings so this would work best if your data variables didn't contain long text strings.

Hope this helps,
GJ
 
Can you do that? I thought that cfinsert needed data from a table. Would the variables on the next page then be url.data1 etc.?

THANKS FOR THAT,

liark

Liark
mark@liark.com
 
Hey liark,

As I understand it, <cfinsert> looks for form variables to use so url variables might not work. In the later versions of CF, you can modify form variables with the <cfset> statement but I don't know if you can create them. You might try something like:

<cfset form.data1 = url.data1>
<cfset form.data2 = url.data2>
...

If that doesn't work, I would just use a regular <cfquery> tag instead of the <cfinsert> and that should take care of it.

Hope this helps,
GJ
 
When I said table of course I meant form.....

Anyway, and surprisingly.... IT WORKS! :) I thought it was a long shot, but


<cfset form.data1 = url.data1>
<cfset form.data2 = url.data2>
...

<cfinsert datasource=&quot;ABC_ODBC&quot; tablename=&quot;ABC&quot;>

<cflocation url=&quot;abc.cfm?data1=#form.data1#&quot;>

works a treat. Thanks GJ.


Liark
mark@liark.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top