***<form action="abc.php" method="post">
                    First Name: <input type="text" name="firstname"><br>
                    Last Name: <input type="text" name="lastname"<br>
                    E-mail: <input type="text" name="email"><br>
                <input type="submit">


Using page.php as the template, I added a simple html form with a call to a php file (added html code is bolded and italicized above). The form displays perfectly. However, on pressing submit I get a 404 because it can't locate "abc.php". The URL generating the 404 is: "https://www.example.com/index.php/phpinserttest/abc.php". All files are are in the ../themes directory. Any ideas here ?

  • Context: page.php is of course the wordpress page.php. Probably obvious but I notice I left it out.
    – Dahere
    Commented Nov 3, 2019 at 12:07

1 Answer 1


Please try

<form method="post" action="<?php echo get_template_directory_uri() ?>/abc.php">

I am assuming that abc.php is located in theme folder.

  • Yes abc.php is in the theme folder and the form modification you suggested worked. Thank You.
    – Dahere
    Commented Nov 3, 2019 at 20:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.