Title: Adding a .php page to database
Last modified: August 19, 2016

---

# Adding a .php page to database

 *  5794871
 * [16 years ago](https://wordpress.org/support/topic/adding-a-php-page-to-database/)
 * Is it do-able? Basically, I made a form using simple HTML in a WordPress page,
   but the script that runs the form is a separate PHP file and I want the WordPress
   theme to apply to that file when displayed (which it won’t if it’s not in the
   database).
 * Probably sounds confusing… Don’t hesitate to tell me if you don’t get it lol.

Viewing 15 replies - 1 through 15 (of 15 total)

 *  [davidandre](https://wordpress.org/support/users/davidandre/)
 * (@davidandre)
 * [16 years ago](https://wordpress.org/support/topic/adding-a-php-page-to-database/#post-1428030)
 * hi,
    why don t you paste the code of form directly in the template of your need,
   page.php ….in a div for example. it should work
 *  Thread Starter 5794871
 * [16 years ago](https://wordpress.org/support/topic/adding-a-php-page-to-database/#post-1428036)
 * doesnt work
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [16 years ago](https://wordpress.org/support/topic/adding-a-php-page-to-database/#post-1428038)
 * Why doesn’t it work? I think we need a bit more info on how this all fits together.
 *  Thread Starter 5794871
 * [16 years ago](https://wordpress.org/support/topic/adding-a-php-page-to-database/#post-1428042)
 * If I create a new page and put hte code in “div” you’ll see the code on the page…
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [16 years ago](https://wordpress.org/support/topic/adding-a-php-page-to-database/#post-1428058)
 * You need to put the code in a [custom page template](http://codex.wordpress.org/Pages#Creating_Your_Own_Page_Templates)
   then create a new page and apply the new template.
 *  Thread Starter 5794871
 * [16 years ago](https://wordpress.org/support/topic/adding-a-php-page-to-database/#post-1428062)
 * Is there an English version of what you just said or what that link says?
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [16 years ago](https://wordpress.org/support/topic/adding-a-php-page-to-database/#post-1428064)
 * That **was **the English version. Or about as English as you’ll be able to find.
   🙂
 * It’s not that difficult to create a custom page template. Just copy page.php,
   give the new file a different name (eg: mytemplate.php), add the template comment
   block – with the template’s proper name – at the top and you’re away. If the 
   new template shows up in the Template dropdown box when you go to create a new
   page, you know you’ve successfully created a new page template.
 * At that point, you can start adding your own code to the custom template.
 *  Thread Starter 5794871
 * [16 years ago](https://wordpress.org/support/topic/adding-a-php-page-to-database/#post-1428066)
 * Ah thank you. Much better 🙂
 *  Thread Starter 5794871
 * [16 years ago](https://wordpress.org/support/topic/adding-a-php-page-to-database/#post-1428077)
 * OK so I copied page.php and renamed it. I erased the second part of it below 
   the “************” and replaced it with my code. When editing a theme, it shows
   up as a page. Now what?
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [16 years ago](https://wordpress.org/support/topic/adding-a-php-page-to-database/#post-1428079)
 * Create a new page, apply the new template to it and preview it.
 *  Thread Starter 5794871
 * [16 years ago](https://wordpress.org/support/topic/adding-a-php-page-to-database/#post-1428089)
 * How do you apply the template to the new page?
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [16 years ago](https://wordpress.org/support/topic/adding-a-php-page-to-database/#post-1428148)
 * Use the Template dropdown box on Edit Page.
 *  Thread Starter 5794871
 * [16 years ago](https://wordpress.org/support/topic/adding-a-php-page-to-database/#post-1428270)
 * I don’t know where you see the template drop downbox because I looked everywhere
   and can’t find it.
 *  Thread Starter 5794871
 * [16 years ago](https://wordpress.org/support/topic/adding-a-php-page-to-database/#post-1428271)
 * Never mind found it.
 *  Thread Starter 5794871
 * [16 years ago](https://wordpress.org/support/topic/adding-a-php-page-to-database/#post-1428272)
 * Never mind I got it to work but it’s not really what I wanted to do. The page
   shows up blank. I wanted the page to KEEP the wordpress theme but contain PHP
   code.

Viewing 15 replies - 1 through 15 (of 15 total)

The topic ‘Adding a .php page to database’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 15 replies
 * 3 participants
 * Last reply from: 5794871
 * Last activity: [16 years ago](https://wordpress.org/support/topic/adding-a-php-page-to-database/#post-1428272)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
