Solved

Making a custom form in WordPress

Posted on 2014-01-22
5
548 Views
Last Modified: 2014-01-23
Can someone please post links to learning resources that can tell me how to do the following tasks in WordPress:

1. Present an HTML form to gather a client's name and email address
2. Run the Action= script  that receives the input from the form
3. Add the name and email address to a custom data base table.

I'm an experienced PHP developer but I don't know WordPress at all and have just begun creating a child theme and a plugin.  So I'm looking for a little jump-start on some of the basic tasks.

Thanks and regards, ~Ray
0
Comment
Question by:Ray Paseur
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 70

Accepted Solution

by:
Jason C. Levine earned 500 total points
ID: 39801246
Hi Ray,

There are LOTS of ways to skin this particular cat.  The exact method you choose will largely be determined by how tightly integrated you want the data to be.  A simple collection form without further extraction on the front end is a relatively simple thing for any developer and requires a minimal knowledge of WordPress trivia.  The solutions get progressively more complicated from there...

The easiest and least WordPressy way to do this is to make a custom page template:

http://codex.wordpress.org/Page_Templates

in the theme and just add all the relevant PHP and HTML to the template and only minimally worry about the WordPress architecture and ecosystem.  

On the WordPress side, when you go to publish the page with the form, you use the Template Selector shown in the link above to choose this template.  Content is optional...you are hardcoding it anyway so all content could be in the template file or you could position the_content() above or below your hardcoded form and the page template will display the content as needed.

-----------------

The next step up in complexity is to "do it the WordPress way" and use WordPress functions to register the new table within the hierarchy which makes it visible and available to other WordPress functions. The best and most basic explanation I have found is this one:

http://wp.tutsplus.com/sessions/custom-database-tables/

It's a little below your level but it does a nice job of showing the WordPress-specific syntax used to pass MySQL queries to registered tables with $wpdb.

-------------

The most WordPress-specific way of doing this is to not use a table at all and instead register everything as custom fields.  There is a fair bit of controversy about the wisdom of this, especially on large sites so I will just mention it and leave it alone otherwise.

You can also use plugins to bypass the developer entirely, but again I sense that's not quite what you are looking to do.
0
 
LVL 110

Author Comment

by:Ray Paseur
ID: 39801583
That's great, Jason.  Thanks a ton! ~Ray
0
 
LVL 110

Author Closing Comment

by:Ray Paseur
ID: 39801585
Just what I was looking for, thanks!
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 39801589
You're welcome.  Feel free to post back here with anything you need clarification on.
0
 
LVL 110

Author Comment

by:Ray Paseur
ID: 39801874
Yeah, I know Andrew.  He's a member of the DC PHP Users Group.
0

Featured Post

Want Experts Exchange at your fingertips?

With Experts Exchange’s latest app release, you can now experience our most recent features, updates, and the same community interface while on-the-go. Download our latest app release at the Android or Apple stores today!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

WordPress is constantly evolving, and with each evolution appears to get better and better.  One of the big drawbacks prior to version 3 was that there was no way to be able to set up a custom menu from the backend. The Old Way Adding menus is…
In this article, we will look at our content management system as a whole, to get an idea of how we will start to manage these content items.
The purpose of this video is to demonstrate how to properly insert a Vimeo Video into a WordPress site or Blog. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp…
The purpose of this video is to demonstrate how to integrate Mailchimp with WordPress, by placing a Mailchimp signup form on a WordPress Page or Post. This will be demonstrated using a Windows 8 PC. Mailchimp will be used. Log into your Mailchi…
Suggested Courses

627 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question