WordPress.org

Ready to get started?Download WordPress

Forums

How to insert data in to a custom table in database? (14 posts)

  1. ilu
    Member
    Posted 5 years ago #

    Hi all,

    I can't believe I still haven't figured this out but how can I insert data from a few drop downs and forms in to a database and a table created just for them? I'd like the web page to be able to do the following:

    1) Show me a few drop downs and forms which I could fill out
    2) Insert the data from those drop downs and forms in to a table in database
    3) Show the filled out data on a custom made archive page

    Could you please help me out on this? Is there a plugin or some such which I could use on my site?

    Thanks in advance,
    Ilu

  2. MichaelH
    Member
    Posted 5 years ago #

  3. ilu
    Member
    Posted 5 years ago #

    Thanks for the reply! I'll look into that. It seems promising.

  4. ilu
    Member
    Posted 5 years ago #

    However,

    Supple Forms only a provides a way to fill in forms while editing posts or pages. I'd like to show the form to everyone navigating to my web page. I was unclear about this in the first message, sorry about that.

    I've been browsing extend/plugins for a while and I'm amazed there doesn't seem to be a complete solution for this. After all, isn't this like one of the most typical use case scenarios there is?

    Another hint, anyone? Your help would be highly appreciated.

  5. MichaelH
    Member
    Posted 5 years ago #

  6. ilu
    Member
    Posted 5 years ago #

    To me it seems that TDO Mini Forms only makes it possible for users to submit posts.. Thanks anyways for your quick reply.

  7. MichaelH
    Member
    Posted 5 years ago #

  8. the_dead_one
    Member
    Posted 5 years ago #

    The purpose of TDO Mini Forms is only to support adding posts/pages (and near future, editing posts/pages). Why are you trying to access SQL via a form in WordPress? Sounds like you're building something outside of WordPress but want to do it "inside" WordPress?

  9. ilu
    Member
    Posted 5 years ago #

    I'm trying to create a submit form with WordPress because WordPress has many great features that I'm hoping to take advantage of with the rest of my project. However, I still can't believe that a simple task like this has proved to be so difficult.

    Is there another solution (other than WordPress) for my solution? I've been googling around but haven't found any.

    Thanks for your replies.

  10. Ray Mannion
    Member
    Posted 4 years ago #

    Just wondering if you found a solution to this issue? I agree with you in that it seems like a common request but I also understand the complexity of creating a front end database maintenance plugin.

    I'm almost at the point of copying an existing plugin that accepts values and reports them in a screen with a search. That's what I need to do is create a list of schools in a mysql database and then have a wordpress page that searches them and lists them in a table.

    Thanks for any suggestions!

  11. Ray Mannion
    Member
    Posted 4 years ago #

    Okay - this looks like what we need:
    http://wordpress.org/extend/plugins/pods/

  12. Ray Mannion
    Member
    Posted 4 years ago #

    well, I actually gave up on pods. I think it is a terrific plug-in but not really mature enough in terms of support. I really tried to use their most basic example and couldn't get the features to work. As with most plug-in support, they are too busy to respond to individual requests.

    I decided to go with exec-php and just code my own php/mysql in the page.

    My only real sources of help were the wpdb codex and the exec-php plugin documentation.

    My wp page consisted of
    1) defining the $wpdb as a global (took me a while to figure that out)
    2) defining my html form using method="POST"
    3) about 20 iterations of trying to construct the SQL syntax for a dynamic where clause
    4) retrieving the results and outputting an html table

    This snippet helped a great deal:

    $fivesdrafts = $wpdb->get_results("SELECT ID, post_title FROM $wpdb->posts
    	WHERE post_status = 'draft' AND post_author = 5");
    
    foreach ($fivesdrafts as $fivesdraft) {
    	echo $fivesdraft->post_title;
    }

    I would paste the whole thing here but I'm not entirely sure how secure this all is and am only beginning to follow some of the information on securing WP and exec-php.

  13. figaro
    Member
    Posted 4 years ago #

    The following could save you a lot of time and trouble.

    http://www.phpmyedit.org/

  14. guiambros
    Member
    Posted 4 years ago #

    MichaelH: thanks a lot for the tip about cforms!

    It's an amazing and very helpful plugin. Gladly donated a bit to these guys; they really deserve it.

Topic Closed

This topic has been closed to new replies.

About this Topic