Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress

Katarzyna Walsh
Katarzyna Walsh
24,409 Points

Submit form and display data on home page

Hello, I wonder if someone could help me with a form/functionality. I'm trying to figure out a way to add a form on a Wordpress site where users will select items from a drop down menu and submit a number for that item. I need the total number for each item to be displayed on the front page, or a different page, ideally in descending order. It does not have to be a form, I thought that form would be easiest. It's probably simple, I just haven't learnt the right thing yet... Any idea very welcome! Thank you!

2 Answers

Adam Moore
Adam Moore
15,825 Points

I would ask how critical saving or keep track of this number is. You could make some selects, or whatever, and keep track of everything with JavaScript displaying the end result also using JS. Wouldn't have much to do with WordPress or PHP. If you're looking to persist that data you could use a browser cookie or something... If you're looking to save that data you'd be looking at implementing a form that could post to PHP and have a way to save that to either the WP database or something else. Then to display it, pulling it out of the DB... Not sure what direction you're looking to take.

Katarzyna Walsh
Katarzyna Walsh
24,409 Points

Hi Adam, Thank you so much for your reply! I do need to save the data. I think it will be helpful to explain to you what I'm trying to achieve in more detail - it's going to be awesome ;-) I want runners to be able to enter in how many miles they have run and choose a team from a list - they will be submitting their miles for their chosen team. The team that wins will get some great prizes. I would like to have the results displayed on the homepage so that everybody can see who is in the lead. Does this sound complicated? Can you point be in the right direction of what PHP topic to concentrate on? I have done a basic course but I'm still far from knowing how to handle this.

Thank you!