including an external form
OK… so this is not exactly a pure wordpress question but I’m trying to do something with wordpress and you folks are very responsive, knowledgeable and patient so I’m giving you a try.
I currently have a form in one of my pages that gathers data from the user and using HTTP POST the same form to process the data entered. I use the RunPHP plug in.
For exceedingly ridiculously complicated reasons that I won’t elaborate on, I have to move this form to another web server – net is, the site is for a company that is splitting apart and the form and the processing becomes part of another company. All rather messy and silly.
My objective is to make this look as seamless as totally possible. I’d like the web site to look nigh on identical to how it was before. Now when i say this i mean – look and feel of the site, header, footer, sidebar all same, same styles etc – URLs can be different – including the domain name.
Now, i am hoping that those of you still with me are either thinking … “is that all? .. that’s easy” or maybe thinking .. “this is an interesting challenge… i fancy helping this chap out”. Either way … I’ve been looking at it all afternoon and have not come up with an elegant solution.
Let me also add, once this site is split up, I’m going to be maintaining the form end of the business and not the WordPress end that the form is embedded into presently so I really need something that i can hand over and provide a neat(ish) interface that would work on things other than WordPress if those who are taking over want to use something different.
I have a vendor who has a
<form>on their site that i want to include within my own page on WordPress. I use RunPHP to embed html/php code in my wordpress page.
Here’s been my thoughts…
Now my first thinking was a simple PHP INCLUDE however per the PHP site:
If the target server interprets the target file as PHP code, variables may be passed to the included file using a URL request string as used with HTTP GET. This is not strictly speaking the same thing as including the file and having it inherit the parent file’s variable scope; the script is actually being run on the remote server and the result is then being included into the local script.
and I need to use the PHP POST method to post back to this form to process the data entered by the user.
My second thinking was to use an iframe – hmm, i see these really are frowned upon :-). Anyway, undeterred I tried but the WordPress theme isn’t picked up. I thought of adding through the query string, the URL of the stylesheet that the page containing the form within the iframe could use. No matter what i tried i could not get the content of the iframe to look pretty and since iframes are so frowned upon and I’d be gussingpretty much with parameters onthe iframe such as height and width i thought … sod it, time to move on.
My third idea was to just have the original site launch the form on the new server. The disadvantage here is that the domain name in the URL would change and that might deter some people since i am gathering some personal information (over SSL mind!). I thought that it would probably work if the calling site gave me through query string, the URL of html to use before the
<form>itself appears and the URL of html to use after the
</form>. I was thinking… that’d work … I’d simply be back to putting PHP INCLUDE(https://….) at the top and bottom of my form to wrap my form in the right html to give the header, footer, sidebar and theme.
I think this has merit, except since the WordPress site is dynamic I’d essentially need two .php pages that mimic what WordPress creates around the content of the page.
So, my question is… how would i do this? Or, are there other alternative solutions that I am ignorant of.
Thanks for sticking with me through this rather long post.
- The topic ‘including an external form’ is closed to new replies.