Support » Plugins » Hacks » Beginner's Help

  • Hello,

    I have a beginner’s question. It’s loaded, but please bear with me.

    I have a project I’m trying to get off the ground. I don’t know where to start. There is a learning curve for Templates and Plugins. I want to know where to spend my energies.

    What I am trying to do is create a form my kids can use so as to make things fun and interesting at home for a family project that may last a lifetime. The form will contain two drop down fields, a file upload field, two hidden fields containing javascript created information, and a submit button.

    The drop down fields will get their information from the database. I know how to do that with one field, but not two – can I use the same method to add a second drop down field? Each new file upload will save as a separate database entity (separate from regular post, page submissions). The family will also be able to use a hierarchical comment structure for each file upload. I hope these file uploads will add up to tens of thousands in the next few years. I would like the option to archive these submissions.

    How should I approach this situation? This is what I have up to now:

    • Create a plugin
    • Create custom fields for the data used in the drop-down fields
    • Manage the drop-down database entries using a back end interface

    I do not know what method to use to store the submitted form data.

    Can you help me figure this out? Is there an easier way (other than using a pre-existing solution)?

    I have been programming with PHP and MySQL for over 6 years, and I usually use Joomla!. My experience with Joomla is limited, I did some template rejigging. Now, I am trying WordPress and it appears to be solid and fun. I come from a place where I have to set up the looping, DB connections, image upload scripts, validation, etc. – I did everything. The API for WordPress confuses me, I have been reading for a week on hooks, custom fields, get/set/update post_meta, etc… All I understand is that custom fields allow me to save one-dimensional data. I know I am wrong, but I am stuck.

    I love to program, it’s relaxing for me and it’s a hobby. This is why I want to build this plugin without getting an existing solution. Any help is appreciated!

Viewing 1 replies (of 1 total)
  • Moderator bcworkz


    It’s difficult to make specific recommendations without more detail on what you’re actually doing, hopefully my general comments will get you going in the right direction.

    About populating form elements from the database. If you know how to do one, you know how to do any number. Use PHP to grab the info you need and output the resulting HTML. Rinse and repeat

    There’s any number of ways to handle uploads. I think creating a custom post type will serve you well. This is how WP handles attachments such as images etc. You could possibly even use the existing attachment post type, but creating your own is fairly straight forward, then you will have more control over the details of how it interacts with the rest of WP.

    As far as storing form data, you can do what ever makes sense. You can use one of the several metadata tables if the data relates to one of those types, or you can create your own table(s) to meet your specific requirements. The advantage of the metadata tables is existing functions are in place to make interacting with the tables easy. With your own tables, you will use $wpdb methods. These methods are basically just a wrapper for PHP mySQL functions, but the nitty-gritty connection details are handled for you, so there is a benefit. The only restriction is the tables must be part of the same DB as WP.

    Sounds like a fun project, if you are like me, you will get much enjoyment (with some frustration) from it. Have fun, cheers!

Viewing 1 replies (of 1 total)
  • The topic ‘Beginner's Help’ is closed to new replies.