I'm trying to pass error messages or regular messages from a page that processes a form post request to the page it then redirects to (after processing).

Since i want to get rid of the POST request header (you know...browsers trying to repost on page reload), i need to redirect (no include or using same page, possible). Or can i somehow get rid of the POST request header?

I'm wondering if there's any non-visible way of passing my messages to the next page, since i can't use $_SESSION and don't want to use GET request parameters.


  • Can you use cookies? – Jan Fabry Feb 15 '11 at 13:36
  • how about ajax? – Bainternet Feb 15 '11 at 14:30
  • Don't like using cookies just to pass (error) messages from one page to the next. And the form contains an upload button, so unless i want to get into writing iframe-pseudo-ajax, it doesn't work either. ;-) However, found a solution, see below. – wyrfel Feb 15 '11 at 20:38

Hehe, got it meself, just a little too late, unfortunately, now i have to change half the stuff again...

set_transient(), get_transient() and delete_transient() will be my friends

Edit: More on this...i now realized that my wp_options table is full of _transient_xyz records, coming from WP itself. So that indicates that WP is using the db to store these transients, which isn't ideal. Haven't done the research, yet, but i hope WP cleans this up in regular intervals.

| improve this answer | |

Sessions would be the best choice, that's what i'd do atleast. and if the content that you are transferring is something very important you might want to Encrypt it before storing it in the session.

Why can't you use $_SESSION, btw?

The other good solution would be to use AJAX functionality.

| improve this answer | |
  • Wordpress unsets $_SESSION if register_globals is set in php.ini. – wyrfel Feb 15 '11 at 20:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.