Bummer! This is just a preview. You need to be signed in with a Basic account to view the entire video.
Challenge1:08 with Alena Holligan
Ready for a challenge? You've learned a lot about PHP and databases so far. Functions, Queries, Conditional Statements and Loops. In fact, you've learned enough to pull the genres for the form dropdown from the database. For this challenge, I want you to use the database for the genre dropdown instead of hard coding it.
Refresher on Adding People and Roles
Challenge: Use the database for the genre dropdown
- Pull all the genres from the database
- sorted alphabetically
- grouped by category.
- Loop through those results
- Create the HTML for the genre dropdown.
- Include HTML to select the genre that the user submitted.
You've learned a lot about PHP and databases so far.
Functions queries, conditional statements and loops.
In fact, you've learned enough to pull the genres for
the form drop down from the database.
For this challenge, I want you to use the database for the genres drop down.
Instead of hard coding it, this will require several things.
First, you'll need to pull all the genres from the database, sorted alphabetically,
and grouped by category.
Second, you'll need to loop through these results and
create the HTML for the genre's dropdown.
Third, you'll need to make sure that the HTML includes an optional selection for
the genre that the user posted to the form.
Remember, comments are a great way to start.
They help you to organize what goes where and
to make sure you accomplish all the requirements.
If you're not sure where to start, I've added a link in the teacher's notes.
To take another look at where we pulled people and
rolls for the item details page.
In the next video, I'll show you how I solve this challenge.
You need to sign up for Treehouse in order to download course files.Sign up