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

PHP

HTML Forms, PHP

I am having trouble understanding this next challenge...

Next, we need the flavor selected in the dropdown to be submitted to this process.php file. We need to be able to access it in the β€œflavor” element of the $_POST array like this: $_POST["flavor"]. What two changes do we need to make to the HTML? (Hint. We need to add two new attributes. The first needs to be added to one existing HTML element, the second needs to be added to a different existing HTML element.)

Code <p>Your order has been created. What flavor of ice cream would you like to add to it?</p>

<form action="process.php">

    <label for="flavor">Flavor</label>
    <select id="flavor">
        <option value="">&#8212; Select &#8212;</option>
        <option value="Vanilla">Vanilla</option>
        <option value="Chocolate">Chocolate</option>
        <option value="Strawberry">Strawberry</option>
        <option value="Cookie Dough">Cookie Dough</option>
    </select>

    <input type="submit" value="Update Order">

</form>

Could someone please be star and help me out! lol

3 Answers

Yes, I did mange to complete it... It didn't accept the uppercase "POST" method, whereas it accepted the lowercase "post" method.

Thanks for you reply! :)

The first one is the method attribute in form tag. It looks like this:

<form action="process.php" method="POST">

and with the second I am not sure but maybe name attribute to select tag - like this:

<select id="flavor" name="flavor">

which would connect flavor with the chosen option.I am sure about method attribute but not about the second one.

I am glad that I could help :)