Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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.

Thanks.

share|improve this question
    
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

2 Answers 2

up vote 1 down vote accepted

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.

share|improve this answer
    
It does not, transients are not garbage collected (answer there has snippet for example implementation of garbage collection for them). –  Rarst Feb 20 '11 at 11:44

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.

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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