Title: Creating your HTML forms causes problems
Last modified: August 18, 2016

---

# Creating your HTML forms causes problems

 *  [worchyld](https://wordpress.org/support/users/worchyld/)
 * (@worchyld)
 * [20 years, 7 months ago](https://wordpress.org/support/topic/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)

 *  [MichaelH](https://wordpress.org/support/users/michaelh/)
 * (@michaelh)
 * [20 years, 7 months ago](https://wordpress.org/support/topic/creating-your-html-forms-causes-problems/#post-273444)
 * You might look here for an explanation:
    [Template_Hierarchy](http://codex.wordpress.org/Template_Hierarchy)
 *  Thread Starter [worchyld](https://wordpress.org/support/users/worchyld/)
 * (@worchyld)
 * [20 years, 7 months ago](https://wordpress.org/support/topic/creating-your-html-forms-causes-problems/#post-273519)
 * 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.
 * Thanks!
 *  Thread Starter [worchyld](https://wordpress.org/support/users/worchyld/)
 * (@worchyld)
 * [20 years, 7 months ago](https://wordpress.org/support/topic/creating-your-html-forms-causes-problems/#post-273735)
 * 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…
 *  [Monika](https://wordpress.org/support/users/monika/)
 * (@monika)
 * [20 years, 7 months ago](https://wordpress.org/support/topic/creating-your-html-forms-causes-problems/#post-273736)
 * <form method=”get” id=”searchform” action=”<?php bloginfo(‘url’); ?>”>
 * this works for me fine
    kindly regards Monika
 *  Thread Starter [worchyld](https://wordpress.org/support/users/worchyld/)
 * (@worchyld)
 * [20 years, 7 months ago](https://wordpress.org/support/topic/creating-your-html-forms-causes-problems/#post-273741)
 * 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.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 5 replies
 * 3 participants
 * Last reply from: [worchyld](https://wordpress.org/support/users/worchyld/)
 * Last activity: [20 years, 7 months ago](https://wordpress.org/support/topic/creating-your-html-forms-causes-problems/#post-273741)
 * Status: not a support question

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
