WordPress.org

Ready to get started?Download WordPress

Forums

Contact form problems (10 posts)

  1. zkarmi25
    Member
    Posted 6 years ago #

    Hello,
    I'm trying to implement an e-mail contact form that I wrote myself. I have experience with HTML and PHP, and I've written plenty of these before (not for WP), but I am running into a problem with this one.

    The contact form is on a page at http://mydomain/Contact
    The form is supposed to be processed by the same script, so I have the form action set to http://mydomain/Contact. I've tried using the $_SERVER['PHP_SELF'] variable as well, and just /Contact.

    In all of these cases, if the user leaves all of the fields blank, the page acts as it should and prints out the errors saying that required fields were missing.

    However, if the form is filled out correctly, or if the latter two of the 3 required fields are left blank, and the form is submitted, the submit button leads to my 404.php page. I'm not sure why. I am assuming I am providing an incorrect form action, but I can't figure out what the right one is.

    Any help is greatly appreciated. If a look at the code is needed, please let me know. Thanks!

  2. mojorob
    Member
    Posted 6 years ago #

    Have you tried <form action="/index.php?page_id=XX" method="post"> where XX is the id number of the contact page? This worked for me in a contact form I wrote.

  3. zkarmi25
    Member
    Posted 6 years ago #

    Just tried that, still doesn't work =\
    I'm pretty sure I used the right page id, but I got the number in some roundabout way. Just in case I got the wrong one, how do you get the id?

  4. mojorob
    Member
    Posted 6 years ago #

    If you go to Manage->Pages, hover your mouse over the relevant title of the page and and in the status bar you should see something along the lines of http://domain.com/wp-admin/page.php?action=edit&post=XX where XX again equals the page id.

  5. mojorob
    Member
    Posted 6 years ago #

    If your blog address is in a folder such as "blog" then the form action would be <form action="/blog/index.php?page_id=XX" method="post">

  6. zkarmi25
    Member
    Posted 6 years ago #

    I'm wondering, could my problem have to do with the fact that I'm using a Page Template for my contact page, with nothing whatsoever in the textarea on the Edit Page page?

  7. gus.marcos
    Member
    Posted 6 years ago #

    I have exactly the same problem. Did you solve it at last, zkarmi25?

  8. zkarmi25
    Member
    Posted 6 years ago #

    No, unfortunately I have not. I gave up and left it alone for a while. I just upgraded to WP2.7, so I'm hoping I can fiddle around with it and find a solution. If I come up with anything I'll post it here.

  9. girlpaint
    Member
    Posted 6 years ago #

    My contact page installed beautifully, and when I test it, it comes back with "Your message was sent successfully. Thanks."

    Yet, I receive NO email. What do I do?

  10. zkarmi25
    Member
    Posted 6 years ago #

    What are you using, girlpaint? Did you install some plugin? Which one? 'Cause that's not what I used, I wrote my script myself.

Topic Closed

This topic has been closed to new replies.

About this Topic