Title: PHP and database code on Pages
Last modified: August 18, 2016

---

# PHP and database code on Pages

 *  [morroida](https://wordpress.org/support/users/morroida/)
 * (@morroida)
 * [19 years, 9 months ago](https://wordpress.org/support/topic/php-and-database-code-on-pages/)
 * I am in the process of migrating my whole website to WordPress. I was able to
   succesfully convert all my 7k+ Movable Type posts.
 * Now I am struggling with some other pages (not posts). There is a particular 
   page I have that first shows a selects box, the user than selects something in
   the drop down box and clicks ok, the page is then reloaded, and a PHP script 
   gets what the user selected (method=’post’), makes a connection to a database,
   selects data accordingly and shows to the user.
 * How can I migrate that to WordPress?
 * edit: I have the php code working already, but I was unable to make it work inside
   a wordpress page, the database connections get screwed and making the form reload
   the same page is not working either!
 * Thanks

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

 *  [Chris_K](https://wordpress.org/support/users/handysolo/)
 * (@handysolo)
 * [19 years, 9 months ago](https://wordpress.org/support/topic/php-and-database-code-on-pages/#post-451212)
 * Check out the section on creating your own Page Templates at the [Pages](http://codex.wordpress.org/Pages)
   page in the codex.
 * You could create a new Page template, bury all your code into it. Then, in WP,
   create a new Page, select that template, give it a title and (optionally) just
   leave the content area blank.
 *  Thread Starter [morroida](https://wordpress.org/support/users/morroida/)
 * (@morroida)
 * [19 years, 9 months ago](https://wordpress.org/support/topic/php-and-database-code-on-pages/#post-451394)
 * I was able to do what you suggested. It works perfectly the first time it loads,
   but when I click submit and the page reloads itself passing it parameters, for
   example
 * test.com/test-page/?a=a&b=b
 * it won´t work 🙁
 * test.com/test-page with no parameters loads perfectly
 *  Thread Starter [morroida](https://wordpress.org/support/users/morroida/)
 * (@morroida)
 * [19 years, 9 months ago](https://wordpress.org/support/topic/php-and-database-code-on-pages/#post-451466)
 * can anyone help me please 🙁

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

The topic ‘PHP and database code on Pages’ is closed to new replies.

## Tags

 * [database](https://wordpress.org/support/topic-tag/database/)
 * [php](https://wordpress.org/support/topic-tag/php/)

 * In: [Everything else WordPress](https://wordpress.org/support/forum/miscellaneous/)
 * 3 replies
 * 2 participants
 * Last reply from: [morroida](https://wordpress.org/support/users/morroida/)
 * Last activity: [19 years, 9 months ago](https://wordpress.org/support/topic/php-and-database-code-on-pages/#post-451466)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
