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 trialKathryn Notson
25,941 PointsBuild A Basic PHP Website > Adding a Basic Form > HTML Forms
I'm not quite sure what to do with Question 4 on this code challenge.
Here's my code.
<!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 method="post" action="process.php">
<label for="flavor">Flavor</label>
<select id="flavor" name="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>
Kathryn Notson
25,941 PointsBen Payne:
Here's what I did: <input type ="hidden" name="order_id" value=7546>. I placed it above the other <input> tag. It passed. However, the instructor didn't cover the "hidden" attribute in her videos in this module. That was the tricky part. The value is an integer & not a string.
2 Answers
Stanimir Petkov
9,563 Points<option value="$_POST[flavor]">ā Select ā</option> :)
Kathryn Notson
25,941 PointsStanimir Petkov:
See the answer I used. I don't think your answer quite answers the code challenge question as there are 3 attributes to be added to a new HTML element. I think your answer should appear as follows: <option value="$_POST["flavor"]"></option>. You don't need 2 "Selects" in the code as that is the "title" of the drop down menu of flavors. (Remember DRY, Don't Repeat Yourself, in code.) The "—" is an "em dash," which is a special character of 2 dashes on either side of the word "Select" in the drop down menu, like so: "--Select--". I had to look up that special character definition.
cktreehouse
10,205 PointsThis is another case where a question is asked that covers material that is not covered in the lesson. I'm posting here because someone else might run across the same issue.
The element to add is a hidden element:
<input type="hidden" id="order_id" name="order_id" value="7546">
Ben Payne
1,464 PointsBen Payne
1,464 PointsThe first step is looking for a form that will populate the
$_GET
global array. The following step will require that you populate the global$_POST
array. (Hint: look at the attributes on the form).