Support » Fixing WordPress » Creating your HTML forms causes problems

  • I’ve created my own template which is basically a form. The data is meant to go back to the same page and do all the processing necessary.

    However, for some reason when I put ‘action=”<?=$PHP_SELF;?>” it always go’s back to the index.php and not to the actual page.

    I’ve tried hard-coding the actual page URL (ie: /?page_id=6) into the form, but it always go’s to index.php

    I tracked down the page it’s going to, it’s calling “single.php” in the theme directory, but I do not why.

    So, in summary.

    1. Created a new .php in the theme’s directory (ie; contact page)
    2. Associated a page created in WP to the new theme I created in point 1.
    3. Make the page have a form which sends data back to itself using $PHP_SELF or $_SERVER[‘PHP_SELF’];
    4. Doing this makes the data go to index.php
    5. Making the page go to “?page_id=7” still makes it go to index.php

    Why can’t I send data back to the same page? How do I solve this?

Viewing 5 replies - 1 through 5 (of 5 total)
  • You might look here for an explanation:

    Thank you for your help.

    I recently made a “contact form” .php file which sits as a template in my themes directory.

    Amazingly, this form works — but no other form does, which I found very strange – but I’m sure you’re link will help.


    I have now solved the problem — for some reason an empty $PHP_SELF will make it go back to the same page, but if you put in a normal address it goes elsewhere…

    <form method=”get” id=”searchform” action=”<?php bloginfo(‘url’); ?>”>

    this works for me fine
    kindly regards

    Yes, but that is a get, my form used a post — either way it is working now, and I am happy!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Creating your HTML forms causes problems’ is closed to new replies.