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 Build a Simple PHP Application Integrating with PayPal HTML Forms

kush sharma
PLUS
kush sharma
Courses Plus Student 2,360 Points

Can't figure out the second change here besides adding the method POST

<!DOCTYPE html>
<html>
<head>
    <title>Ye Olde Ice Cream Shoppe</title>
</head>
<body>

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

    <form>

        <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>

</body>
</html>

6 Answers

kush sharma
PLUS
kush sharma
Courses Plus Student 2,360 Points

Well thanks for that... But i have seen method=POST in many places in php codes.

But thanks for the pointer.

Andrew McCormick
Andrew McCormick
17,730 Points

this exact question comes up a lot on the forum, hence how I knew that it needed to be lowercase. In reality it typically doesn't matter. In the HTML the element is case-insensitive, however in XHTML you must use lowercase.

Andrew McCormick
Andrew McCormick
17,730 Points

please let us know which question of the challenge you are on.

kush sharma
PLUS
kush sharma
Courses Plus Student 2,360 Points

Hi Andrew, thanks for the response. I am currently on this question and kind of stuck here figuring out the second attribute to be added to the HTML element in the code above, i added method="POST" but can't think of the second one.

Challenge task 2 of 3

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.):

Andrew McCormick
Andrew McCormick
17,730 Points

to access an element in the $_POST array, you need to give it a name. So if you are try to access an element via $_POST['flavor"] then some element needs to have a name of 'flavor'

kush sharma
PLUS
kush sharma
Courses Plus Student 2,360 Points

Yeah that's what i thought and added name="flavor" to the select element here but still no use.

Andrew McCormick
Andrew McCormick
17,730 Points

when you added the post method did you use all caps? method=post should be lower case.