• justinbyrne001

    (@justinbyrne001)


    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!

    [Code moderated as per the Forum Rules. Please use the pastebin]

    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!

    [Code moderated as per the Forum Rules. Please use the pastebin]

    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 protected]
    work_phone: 1231231234
    cell_phone: 1231231234
    url: 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

    (@flatwhitestudio)

    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://ww.wp.xz.cn/extend/plugins/contact-form-7/

    For your form data collection and displaying them, see:
    Contact Form 7 to Database Extension – http://ww.wp.xz.cn/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

    (@justinbyrne001)

    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.