The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End WordPress blank page on form submission, No plugin just PHP

  • This topic is empty.
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
  • #198979

    For my personal website, I am trying to learn a bit more about forms and PHP validations rather than use a plugin. It’s a simple form with a $fullname, $email, $subject, $website, $message and a normal submit button.

    I linked a codepen just to show you my PHP and HTML. I couldn’t get them to show up in here for some reason.


    I have read that leaving the action=”” attribute empty will basically just refresh the page whenever the form is submitted. My website is simply one page so I don’t really need it to redirect me to another page.

    The PHP that checks if the fields are empty work because it revealed the appropriate message, although for obvious reasons, having them display before the user attempts to submit anything is pointless.

    I’m not sure if the IF statement surrounding the empty IF statements is right but either way when I click submit button, it refreshes the page and its now an empty blank white page with no HTML. The URL localhost:8888/wordpress stayed the same though except its a blank page.

    This is really annoying me and no matter what I try I get the same result. Any ideas what I’m doing wrong and is this a specific wordpress issue?


    There’s obviously something in your content that the forum doesn’t like.

    Try making sure that any commands or code or whatever are wrapped in backticks like the example right below this box where it says “Posting Code”

      function example() {
        element.innerHTML = "<div>code</div>";

    Please don’t keep starting new threads when whatever you are doing isn’t taking effect properly.


    In wp-config.php, change this line:

    define('WP_DEBUG', false);

    To this:

    define('WP_DEBUG', true);

    Try again and see if there are any PHP errors now that may give you some clues.


    @Senff It is already on and it isn’t showing any errors that makes sense. The only errors are regarding the variable that contains the hidden submitted input below. :s


    Well considering the new thread is about a different issue, I would see this as being a good idea. Why would I keep posting in a CSS thread I created for example when its a PHP problem and a completely different problem?


    I figured it out. In the reading section of wordpress, I set it to use a page for my front page instead of having it set to “your latest posts” only because I don’t have a blog yet.

    I had all my code inside the page.php file instead of the index.php file so whenever I hit submit, it would refresh and essentially load the blank index page. I just transferred all my code into the index file, adjusted my file paths and put it back to “your latest posts” so that it would read the index file and it worked. Everything is good for now :) I just thought I would update my thread.


    @Thadley, you can look at the Template Hierarchy on Codex. It’s a great guide to how WP templating works. You can also create your own custom templates, which is a great way to handle multiple variations of page templates. Hope that’s helpful. Alen.

    Sagive SEO

    since your using WordPress i would skip the whole refresh page to submit a form and use ajax…

    That makes the whole error checking simpler and also helps you avoid the refresh which is just 1990.

    Here is the HTML code:
    Here is JS code:
    Here is the PHP code:

    Place JS & PHP file in a folder named “ajax” in your theme folder, include the PHP file in your functions.php file and your done.

    Best of luck ;)

Viewing 7 posts - 1 through 7 (of 7 total)
  • The forum ‘Back End’ is closed to new topics and replies.