Redirect to previous page

This is maybe very simple but I don’t see things clearly at the moment. I have a login form on every page of the site. The form goes to an action page which verify if the member is in the database. I would the member to be redirected to the previous page if the login information is correct, so they can continue what they were doing. What is the easiest way to do this?

The easiest way is the send the referring URL as hidden field in the form and then redirect the user back to it.

Keep in mind CGI.HTTP_REFERER can be blank. So be sure to handle that scenario in code.

Thank you Rudi. That was a stupid question which I asked before thinking :rolleyes:

on action.cfm I have now:

<cflocation url="#CGI.HTTP_REFERER#" addtoken="no">

no, it is provided automatically in action.cfm, i.e. the cf template that receives the form submission

Hi Rudi maybe a stupid question? Do I add the CGI.HTTP_REFERER to the action? like:

&lt;form action="action.cfm?#CGI.HTTP_REFERER#" method="post" name="testForm"&gt;CODE]

Thank you for that will keep that in mind!

agreed

uh… what about using CGI.HTTP_REFERER ?? surely that’s a bit easier than a hidden form field