***<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 Nov 3 '19 at 12:07

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.

| improve this answer | |
  • Yes abc.php is in the theme folder and the form modification you suggested worked. Thank You. – Dahere Nov 3 '19 at 20:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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