How can I make a form submit to itself without hardcoding the file name?

The ColdFusion CGI variable CGI.SCRIPT_NAME contains the name of page being executed, so you can use:

<cfoutput>
<form action="#CGI.SCRIPT_NAME#" method="post">
</cfoutput>

Note the use of <cfoutput> around the form tag. This is required unless you are using <cfform>.

This question was written by Ben Forta
It was last updated on January 9, 2006.

Categories

Forms

Comments

comments powered by Disqus