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 trialkush sharma
Courses Plus Student 2,360 PointsCan'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="">— Select —</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
Courses Plus Student 2,360 PointsWell thanks for that... But i have seen method=POST in many places in php codes.
But thanks for the pointer.
Andrew McCormick
17,730 Pointsplease let us know which question of the challenge you are on.
kush sharma
Courses Plus Student 2,360 PointsHi 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
17,730 Pointsto 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
Courses Plus Student 2,360 PointsYeah that's what i thought and added name="flavor" to the select element here but still no use.
Andrew McCormick
17,730 Pointswhen you added the post method did you use all caps? method=post
should be lower case.
Andrew McCormick
17,730 PointsAndrew McCormick
17,730 Pointsthis 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.