Title: Can&#039;t insert data from &quot;&quot; using &quot;$_POST&quot; into WP DB using $wpdb-&gt;insert
Last modified: August 20, 2016

---

# Can't insert data from "" using "$_POST" into WP DB using $wpdb->insert

 *  [justinbyrne001](https://wordpress.org/support/users/justinbyrne001/)
 * (@justinbyrne001)
 * [15 years ago](https://wordpress.org/support/topic/cant-insert-data-from-using-_post-into-wp-db-using-wpdb-insert/)
 * To begin, I have a “Dev Environment” setup on my computer. WordPress is running
   through **XAMPP** within it’s normal structure and as as far as I can tell everything
   is running properly.
 * The problem that I’m running into is that I’m trying to capture information from
   several form fields hosted on a unique template page. Here’s how the page is 
   setup:
 * Pastebin: [code url!](http://pastebin.com/embed_js.php?i=DiZtXPu6)
 * _[Code moderated as per the [Forum Rules](http://codex.wordpress.org/Forum_Welcome).
   Please use the [pastebin](http://wordpress.pastebin.com/)]_
 * The information from this form is captured and sent via the **post ** method.
   The PHP page that suppose to collect this information **collect.php** captures
   each post within a unique variable through the **$_POST** method. Here’s sort
   of what that page looks like.
 * Pastebin: [Code url!](http://pastebin.com/embed_js.php?i=wrQQqvvw)
 * _[Code moderated as per the [Forum Rules](http://codex.wordpress.org/Forum_Welcome).
   Please use the [pastebin](http://wordpress.pastebin.com/)]_
 * This is the page that is see after the submission of the form forwards me to **
   collect.php**:
 * > Echoed output through captured POST
   > Fname: FirstName
   >  Lname: Lastname email: [email@server.com](https://wordpress.org/support/topic/cant-insert-data-from-using-_post-into-wp-db-using-wpdb-insert/email@server.com?output_format=md)
   > work_phone: 1231231234 cell_phone: 1231231234 url: [http://www.url.com](http://www.url.com)
   > add_info: Additional Info
   > End of output!
   > **Notice:** Trying to get property of non-object in **…\collect.php** on line**
   > 29**
   > **Fatal error:** Call to a member function insert() on a non-object in **…\
   > collect.php** on line **33**
 * **Now here’s the problem:** I seem to be capturing and storing the data/info 
   within the variables just fine. It’s just that when I try and insert this data/
   info into the wp_subject_info table within the WordPress database it doesn’t 
   work. I can’t figure it out! I understand that the solution is most likely insanely
   simple but I can’t find a plausible solution anywhere. If anybody could help 
   it would be greatly appreciated. Thanks in advance.

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

 *  [Adrian Wong](https://wordpress.org/support/users/flatwhitestudio/)
 * (@flatwhitestudio)
 * [15 years ago](https://wordpress.org/support/topic/cant-insert-data-from-using-_post-into-wp-db-using-wpdb-insert/#post-2081677)
 * Hi justinbyrne001,
    Rather than reinventing the wheel, why not use something 
   that has already been developed?
 * Here are some plugins which should be able to do what you needed.
    For your forms
   creation, see: Contact Form 7 – [http://wordpress.org/extend/plugins/contact-form-7/](http://wordpress.org/extend/plugins/contact-form-7/)
 * For your form data collection and displaying them, see:
    Contact Form 7 to Database
   Extension – [http://wordpress.org/extend/plugins/contact-form-7-to-database-extension/](http://wordpress.org/extend/plugins/contact-form-7-to-database-extension/)
 * There should be a solution to what you wanted but I guess that it may be just
   as easy to find out what’s out there already.
 * Hope it helps, 🙂
 *  Thread Starter [justinbyrne001](https://wordpress.org/support/users/justinbyrne001/)
 * (@justinbyrne001)
 * [15 years ago](https://wordpress.org/support/topic/cant-insert-data-from-using-_post-into-wp-db-using-wpdb-insert/#post-2081691)
 * I know you’re right and for now I believe that this is the route that we’re going
   to have to go. It’s not the fact that I’m against using plugins it’s just that
   I wanted to be able to do this myself and understand the process that’s going
   on. I’m new at this whole WordPress thing and would really like to know how it
   operates through and through that’s all. I really do appreciate you’re help but
   I’m unfortunately still within the search for the ability to do this using my
   own code. I thank you once again for you’re reply, it matters to me when people
   actually take the time to notice when someone needs help, thanks!

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

The topic ‘Can't insert data from "" using "$_POST" into WP DB using $wpdb->insert’
is closed to new replies.

## Tags

 * [$_POST](https://wordpress.org/support/topic-tag/_post/)
 * [database](https://wordpress.org/support/topic-tag/database/)
 * [db](https://wordpress.org/support/topic-tag/db/)
 * [php](https://wordpress.org/support/topic-tag/php/)
 * [post](https://wordpress.org/support/topic-tag/post/)
 * [sql](https://wordpress.org/support/topic-tag/sql/)
 * [wpdb](https://wordpress.org/support/topic-tag/wpdb/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [justinbyrne001](https://wordpress.org/support/users/justinbyrne001/)
 * Last activity: [15 years ago](https://wordpress.org/support/topic/cant-insert-data-from-using-_post-into-wp-db-using-wpdb-insert/#post-2081691)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
