• I’ve been struggling for awhile on this. I recently created a child theme, it only contains style.css, functions.php and connect.php.

    I am trying to put a simple form into a page, click submit and have it call connect.php. Everytime I click submit I get Error 404 – Page NOT Found.

    Below is the HTML. I know the php works, when I hard code it using the plug in insert_php, it writes to MySQl like I want.

    <html>
    <div class=”label_site”>
    <form action=”connect.php” method=”get”>
    <p>City</p>
    <input name=”city” type=”text”>
    <p>State</p>
    <input name=”state” type=”text”>
    <input type=”submit”>
    </form>
    </div>
    </html>

Viewing 4 replies - 1 through 4 (of 4 total)
  • Use an include in a page template (to include connect.php) and have the form action be that page, or, move connect.php outside your WP folders where rewrite rules are not in effect. If you do that, you will need to process the data back also.

    Thread Starter jordanham

    (@jordanham)

    I kind of figured out what you mean. I copied over the page.php template from my theme into the child and added <?php include(“connect.php”); ?>.

    It now just calls connect.php right away. I would like the info to be input and once they click submit, a new page to open and the inputs sent to connect.php.

    Thanks!

    Thread Starter jordanham

    (@jordanham)

    Ok, I think I have it. I just want to confirm.

    I created a new template and assigned it to a different page (test2).

    I then added the line above to include connect.php in the custom page that I assigned to test2..

    My form’s action (on test1) is now to link to the newly created page (test2) and when it does, connect.php runs

    Is this the right way to do it?

    That sounds rights. Is all working?

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘404 when submitting a simple form’ is closed to new replies.