Support » Fixing WordPress » php, form, post, and response

  • Hi

    I need to create a form that posts to a .php file, i.e.

    <form method=”post” action=”/foo.php”>

    The page with this form itself contains some php code. Now, I’ve installed the exec-php plugin and I’m able to create a wordpress page that generates the form. I’m also able to post to /foo.php and have it do some processing and output the result I need. So far so good.

    However, I want foo.php itself to look like a wordpress page so it blends in with the rest of my blog. I guess ideally, I want to create a wordpress page with php code, and have that page NOT published by default but just sitting there. Then when it’s called the output will be embedded inside the normal blog.

    Just in case that’s not clear, let’s say foo.php contains just this

    echo “hello world”

    Right now, when I call it, I get a page that just says ‘hello world’

    I want to have a page that looks like a regular wordpress page with all my header, footer, sidebar, widgets, etc., and says ‘hello world’, and I don’t want this page to be visible (no link on top) until it’s invoked via a form post from another page. How can I do that?

    Thanks very much in advance.

Viewing 2 replies - 1 through 2 (of 2 total)
  • anyone, please?

    I have created a theme template called form.php that calls all of the normal headers, footers, and sidebars and then includes the form file.
    A page is created with only the text ‘foo.php’ and the Form template is chosen.
    If you don’t want the page to appear in your navigation, then just download the ‘exclude pages’ plugin and uncheck the box ‘include page’ on the page editor.
    Make your form template take the_content of the post, strip the <p> tags and include that file.

    The only problem I am having with this solution myself, right now, is that the php code cannot have any header() functions or anything else that will break in php if done after html is displayed.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘php, form, post, and response’ is closed to new replies.