WordPress.org

Ready to get started?Download WordPress

Forums

form not contacting process.php page for processing (2 posts)

  1. vinsprinter
    Member
    Posted 7 months ago #

    Hi, I am trying to get a small newsletter subscriber form working. I have placed the form in a div on the home page. Page URL = http://localhost/saint_stanislaus - I have set the action of the form to process.php and the method="post".

    The home page is set as a template and not a default. The page is saved as: saint_stanislaus_youth_club_home.php - within this page I have the form set into a <div>.

    I set up another page in wordpress called process.php and the template page for that page is called - process.php and saved to the same directory as the saint_stanislaus_youth_club_home.php

    When I fill out the newsletter form and click the submit button I get this error:

    Not Found

    The requested URL /saint_stanislaus/process.php was not found on this server.

    Can somebody please tell me where I am going wrong. This form works in it's own directory when tested in the browser but when I put it into wordpress it will not work. I know it might be something simple. I would be grateful for any help.

    Also I do not want to use a plug-in. I need to do this so that I can use it in a portfolio for work purposes.

    Thanks

  2. Jos.SnchZ
    Member
    Posted 7 months ago #

    Hi,

    The problem seems related to the form submit action.
    Usually, it's better to POST to the same page and if the data is saved correctly you redirect the user to the thank-you page. Next time the user tries to signup again you'd just check the info in the database before storing the new one.

    If for tracking reasons you need a separate process file, u'd create a WordPress page called Process, exclude it from navigation, and then submit your form to that page. Easiest way immo is:

    $your_url = get_permalink( page_id );
    <form method="post" action="'. esc_url( $your_url  ) .'" name="my-form-name" id="my-form-name">
        your code
    </form>

    Hope that helps,
    Regards

Reply

You must log in to post.

About this Topic