page shows 404 on form submit

i putting something else in action?

Yes. The complete path to the file. If your site is http://mysite.com and you are on the home page then you are requesting a file at http://mysite.com/result.php. If you are on a date archive you’d be requesting a file at http://mysite.com/2013/03/03/result.php. The file you want is actually at http://mysite.com/wp-content/themes/theme-name/result.php. See the problem?

Relative URLs do not work well in a WordPress context.

But I would say that even if you were to construct a complete URL to the template file that you are still doing it wrong. If you load a file like that then none of the WordPress core loads and you tend to get undefined function errors.

The right way to do this, in my opinion, is …

  1. to send the request to the same template file as contains the form.

    <form action="<?php the_permalink(); ?>" method="post"> 
    

    That particular code only works in some circumstances so you may
    need to construct the URL differently, using site_url(), for example. You can usually just omit the action attribute (as prompted by Milo).

  2. You could also hook a function to template_redirect or wp_head
    and process the form on that hook.
  3. Or, use the AJAX API to process the form submission. Of course, that
    means some Javascript as well.

If you form appears on more than one page you will need one of option 2 or 3. Otherwise, use the first option.

If you need the form to appear on one page and the results on another, then you will need a custom page template for each component, and you will need to create a page for the form and another for the results via the “Pages” section of the WordPress backend.