views:

20

answers:

1

Hello,

I'm making a wordpress site which looks like and behaves less like a blog and more like a classic web site. I need to make plenty of custom forms and by now I have three equally bad solutions to this.

One would be to create each form as a theme template file. Those pages would submit data to themselves and all would be great, except the fact that I don't really like my plugin and theme to be so hardly connected. I think that theme should be for design only, which means header, footer, etc... and that plugin should handle all the other work.

Second solution is to make some controller.php file somewhere in my plugin folder and then all requests should be directed to this controller which would control what page should be displayed and how. And each page should be made with the use of WP short codes located inside my plugin folder. Problem with this approach is that I have problems transfer POST parameters, after I submit a form. I would submit a form to my controller which would then redirect it to a page with all POST parameters lost.

Third solution would be to target actual pages which display content with the use of WP shortcodes, and when user successfully submits the form shortcode would instead of the custom form, return some Thank you message. Problem here lies in fact that if you hit refresh while Thank You message is displayed browser would submit the form once again. And again and again, every time you'd press refresh.

Simple question. How would you do it?

Would it be the first way? I see many people doing just that, hardcoding their custom forms inside template files, even though it may be not the cleanest solution. Hmm... Still, I would like to separate my forms and logic away from my theme.

Greets

A: 

There are a couple of good form solutions as existing plugins. The two that come to mind immediately are Gravity Forms, which you must purchase:

http://www.gravityforms.com/

or Formidable Forms, which has a free basic version and a paid advanced version:

http://wordpress.org/extend/plugins/formidable/

I would definitely suggest using a plugin. It's best to keep design and functionality separate when possible. Both of these plugins are pretty simple to use. I know formidable uses shortcodes, but I'm not sure about Gravity Forms

John P Bloch