WordPress.org

Support

Support » How-To and Troubleshooting » Submitting a form on a virtual page

Submitting a form on a virtual page

  • I’ve created a number of virtual pages using add_rewrite_rule

    On one of those pages I need to have an enquiry form. I can generate the form but when it submits to the exact same page I get a “no page found” error.

    I run the add_rewrite_rule everytime on init and I know it’s running. My code on “parse_request” can see that the right variables have been extracted from the url.

    What am I missing?

Viewing 5 replies - 1 through 5 (of 5 total)
  • RichardWPG
    Member

    @richardwpg

    Why don’t you use some plugins?

    Its part of the plugin I’m writing. I’d rather have one complete plugin than cobble several together.

    Pioneer Web Design
    Participant

    @swansonphotos

    Please describe what you mean by using the term ‘virtual pages’?

    Hi

    take a look at sleepouts dot in (temp domain)

    We have regions around the country and each will have customisable contents driven by a plugin. That works as expected using add_rewrite_rule.

    However we have an enquiry/contact form and another ‘purchase’ form. I’ve only done the enquiry one so far and it sets up OK but after the form is submitted it comes back via the 404.php template when it should come back via index.php

    When I put var_dumps in my code I can see that the 404 page has access to the $wp->query_vars that the rewrite code parses out so I have all the info I need.

    To a certain extent I don’t care that the 404 headers get sent because search engines can’t get to the response page but the OCD programmer in me wants to understand why it isn’t working 🙂

    Pioneer Web Design
    Participant

    @swansonphotos

    Please describe what you mean by using the term ‘virtual pages’?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Submitting a form on a virtual page’ is closed to new replies.