Title: plugin admin side form submit
Last modified: August 20, 2016

---

# plugin admin side form submit

 *  [Mohal](https://wordpress.org/support/users/mohal/)
 * (@mohal)
 * [14 years, 8 months ago](https://wordpress.org/support/topic/plugin-admin-side-form-submit/)
 * Hi!
 * Please, help!
 * My plugin’s admin side form needs to insert data into the database. Please note
   that my plugin has its own table (it is required). Now the scenario is like this:
 * Admin side form code is in a function in my plugin primary file, usually the 
   file which has same name as plugin. This function is attached with “add_submenu_page().”
   When the sub menu is clicked… the form is displayed. Everything goes well by 
   this stage. Now to insert the data… I made a new file (suppose: test1.php). I
   changed form’s action attribute to: action=”test1.php”… (test1.php is also in
   my plugin’s folder. Note: Intentionally not writing complete path in action attribute
   here, in my code path is correct). All the data submitted from form do get to“
   test1.php”… I have checked it but I don’t know for some reason… in “test1.php”
   I lost control over WordPress default functions. So, when I try to insert the
   data into the table like… wpdb->insert ()… it gives me error. When I var_dump(
   $wpdb)… it gave me “NULL.”
 * After two days of searching over internet and trying myself and finding no solution
   I am forced to post my problem here. Please help me! I hope someone has answer
   to my question.
 * I think what I am trying to do is using multiple files for my plugin but what
   I don’t get is why WordPress is not supporting it. If I am doing it wrong then
   please, help me!
 * Thanx in advance!
 * Regards!

Viewing 1 replies (of 1 total)

 *  [Big Bagel](https://wordpress.org/support/users/big-bagel/)
 * (@big-bagel)
 * [14 years, 8 months ago](https://wordpress.org/support/topic/plugin-admin-side-form-submit/#post-2335885)
 * It’s probably a minor error in your SQL statement. Use `$wpdb->last_error` to
   return the last error or `$wpdb->print_error()` to print the last error.

Viewing 1 replies (of 1 total)

The topic ‘plugin admin side form submit’ is closed to new replies.

## Tags

 * [action](https://wordpress.org/support/topic-tag/action/)
 * [admin](https://wordpress.org/support/topic-tag/admin/)
 * [attribute](https://wordpress.org/support/topic-tag/attribute/)
 * [form](https://wordpress.org/support/topic-tag/form/)

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 1 reply
 * 2 participants
 * Last reply from: [Big Bagel](https://wordpress.org/support/users/big-bagel/)
 * Last activity: [14 years, 8 months ago](https://wordpress.org/support/topic/plugin-admin-side-form-submit/#post-2335885)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
