in reply to Sending data to browser's URI field via POST

Have you considered redirecting to the URL you prefer after receiving the POST? That could also have the nice effect of preventing some types of multiple submissions.

  • Comment on Re: Sending data to browser's URI field via POST

Replies are listed 'Best First'.
Re: Sending data to browser's URI field via POST
by hacker (Priest) on Mar 12, 2005 at 23:20 UTC

    I don't think this will work well, because it will cause a double-fetch and double-render of the content. Once the form is submitted, the content is fetched, converted, and displayed to the user.

    If I then use a 302, I will end up doing an additional SELECT to pull the url out of the db with that unique hash, then fetch, convert, and render the content to the user again at that final redirected url....

    Though, I store the original and converted content in the db also, so I could avoid a re-fetch over port 80 at least, if I just do a SELECT from there...

    But I'll have to do a pretty significant rewrite to avoid this from happening.

    I'll have to think about this a bit more. Thanks for the suggestion.

      Once the form is submitted, the content is fetched, converted, and displayed to the user. If I then use a 302, I will end up doing an additional SELECT to pull the url out of the db with that unique hash, then fetch, convert, and render the content to the user again at that final redirected url....

      Then don't send the redirect after fetching and rendering the data, do it instead, that way you only render it once.


      We're not surrounded, we're in a target-rich environment!