I’m working on someone else’s code base, and found that they were posting forms to themselves. However they had hard coded the form template names into the code for the form. Like the following:
This is a bit of a pet peeve of mine because it tends to make the code very un-portable. What happens if you rename the file “dosomethingelse.cfm.” Now you have to go back and change the file name and the reference.
It was a quick proof of concept application, so I don’t fault the author. But they just aren’t lazy enough.
I prefer doing it this way:
It’s highly cut and paste-able, and you never have to worry when you rename your templates. If you aren’t using cfform, you can still do it, just wrap the form element in a .
Now, I imagine that I will get a comment that says something about not trusting cgi variables. It works with every flavor of IIS and Apache that I have ever worked with. Anybody see any gotcha’s doing that.