[wp-hackers] Frontend form

Diana K. Cury dianakac at gmail.com
Thu Aug 18 20:08:05 UTC 2011


Thanks for reply Eric,

I will test some more and post the code soon. The most strange is if I add 
the form and form processing code after template calls (get_header, sidebars 
etc), I get the "headers already sent", (both for page templates or 
shortcode insertion). It seems something to do with template header itself.

The processing code should stay before all the html header, or not really 
necessary?! If so, that will be a lot of filterings for get the shortcode 
feature done.

Quite not sure if I should implemente this in my plugin...is an one time use 
form, a shortcode maybe aren't the best aproach for this isn't?!

----- Original Message ----- 
From: "Eric Mann" <eric at eam.me>
To: <wp-hackers at lists.automattic.com>
Sent: Thursday, August 18, 2011 3:18 PM
Subject: Re: [wp-hackers] Frontend form


> We'd have to see what code you're using in the form to diagnose the 
> "Headers
> already sent" issue, but typically this is due to either `echo`ing content
> too early in WP's execution or trying to modify the page headers too late 
> in
> WP's execution.
>
> My guess is that you're trying to use some kind of HTTP redirect within 
> the
> content of the page ...
>
> As for preventing the browser's back button ... don't.  It's bad form to
> modify the behavior of the browser like that, and the user might have a
> legitimate reason to use the back button.  Instead, just validate the form
> to prevent duplicate submissions - i.e. use a nonce to detect whether or 
> not
> this is a repeat submission and reject the re-submission.
>
> On Thu, Aug 18, 2011 at 10:51 AM, Diana K. Cury <dianakac at gmail.com> 
> wrote:
>
>> I have a working frontend form, for create post types.
>>
>> Using as a template for pages: works nice, I'm able to create the post I
>> get redirected to the them right after the process.
>>
>> When I tried to implement this form as a plugin shortcode, I got "Headers
>> alredy sent ". The post is created as well, but doesn't redirect to the
>> post.
>>
>> Also, is there someway to prevent going back in history and re-submit the
>> form again? I know there's a lot of plugin for this, but that is a very
>> simples static form.
>> _______________________________________________
>> wp-hackers mailing list
>> wp-hackers at lists.automattic.com
>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers 



More information about the wp-hackers mailing list