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
Felicia P
2,365 PointsStuck on PHP code challenge - HTML forms
Nevermind finally figured it out.
12 Answers
Unsubscribed User
2,750 PointsThis is what worked for me:
<input type="hidden" value="7546" name="order_id">
James Barnett
39,199 PointsIf you figure something how instead of deleting your question, it's much more helpful to add your answer.
Felicia P
2,365 PointsI trudged through the second one and now I am on the third one. I know I needed to put in a hidden type input and that it needed to have value but I don't know whether it is the number or the "order_id" and I tried name as well but apparently that is wrong. Also I have no real idea why I am doing any of these things just that this is what happens in the video and so that's why I am doing it.
Here is the question: Finally, we need the form to submit a unique identifier for the order to the process.php file. We need to be able to access that value in an “order_id” element of the $_POST array like this: $_POST["order_id"]. For this particular order, the order ID should be 7546. We don’t want this value displayed in the browser. What do we need to add to the form? (Hint: We need to add a new HTML element with three attributes.)
and here is 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 action=process.php method=post>
<input type="hidden" value="Flavors">
<input type="hidden" value="order_id" name="7546">
<label for="flavor">Flavor</label>
<select name="flavor" 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>
(I have no idea what that viper thing is supposed to do there is no about or how to on the website)
Felicia P
2,365 PointsWhen I erased < input type="hidden" value="Flavors" > it worked. But I have literally no clue why. Can anyone explain what the heck is going on with this to me? I am having a harder time grasping this than Latin conjugation.
James Barnett
39,199 PointsThe W3C has nothing to do with PHP, they write HTML & CSS specifications.
You are probably thinking of W3C Schools which are infringing on the W3C's trademark. They are not a reliable source of information.
Post a link to your code your having trouble with using a PHP Sandbox
Matthew Harding
3,099 PointsW3C Schools is actually a good reference at times . What are they paying you to talk down on other tutorial websites as well?
James Barnett
39,199 PointsMatthew Harding - I'm a paying Treehouse member like everyone else. If you are interested in controversy of W3Schools and their use of the W3C's name check out the webstie w3fools.com
Randy Hoyt
Treehouse Guest TeacherSorry you are having with this code challenge! What exactly isn't making sense? This code challenge starts off with an HTML form. When someone views this form.html web page, we want them to select a flavor, click Update Order, and then have that information sent to a particular PHP file on the server to process that information. Does that question make sense?
It might help to review the videos in the Adding A Contact Form section. We're building on what we learned in those videos. The second video, Working With Post Variables, will be especially helpful: the first 20 seconds covers in general how a form sends information to a server, and the first 3 minutes walks through the contact form we built as an example of that process.
Let me know if all that makes sense: if so, we can talk more about the next step.
Randy Hoyt
Treehouse Guest TeacherHey Felicia,
I haven't heard back from you on this. Any luck rewatching the videos? If you send an email to help@teamtreehouse.com, I can connect with you to explain this process a little bit more.
Thanks, ~randy
Aernout Zevenbergen
10,604 PointsYep - stuck there too... :-) Haven't the faintest clue which attributes I have missing...
Randy Hoyt
Treehouse Guest TeacherHey @Aernout,
It might help to review the videos in the Adding A Contact Form section. We're building on what we learned in those videos. The second video, Working With Post Variables, will be especially helpful for figuring out these two form attributes: the first 20 seconds covers in general how a form sends information to a server, and the first 3 minutes walks through the contact form we built as an example of that process.
Sayth Renshaw
1,763 PointsYes I became totally lost here too. I was expecting to see the code in the Mike the Frog project so I was re-looking through there to see if I had typed or used it before.
Joshua Paulson
37,085 PointsI also struggled with this code challenge, The instructions in the teacher's lesson are in PHP and then it has you complete a code challenge in HTML and expects you to know what to do. Hopefully the other Treehouse students can wrap their heads around this one a bit better than I. Because, I made this one harder than it should have been.
Felicia P
2,365 PointsYeah especially since now I am stuck on the second one. I really am having a hard time with this lesson. I must have watched this video five times now and read the php tutorial section on the w3c website. I'm really not understanding why I need to write things in certain ways in php. Some things I understand just for the specified situation and not the broad reasoning and others I don't understand at all.