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 trialHOWARD FLORES
3,066 Pointsam stuck in this code challenge
I call my variable like this $flavor=$_POST["flavor"];
and in the select element call the variable like this
<select name="<?php echo $flavor; ?>" id="flavor">
When i check the code its tell me that the value in the name has to be "flavor"
am i wrong?
2 Answers
HOWARD FLORES
3,066 PointsSorry my error was put the wrong method so
Question 1 The code below contains a simple HTML form. It looks fine in the browser, but it does not send the information to the server. In this code challenge, weβll make a few modifications so that it will. First, we need the data submitted to a process.php file in the same folder as this form.html. What do we need to add to the HTML? (Hint: we need to add one attribute to an existing HTML element.)
<form action="process.php">
Question 2 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.)
<form action="process.php" method="post"> //my error was type method="POST" :(
<label for="flavor">Flavor</label>
<select name="flavor" id="flavor">
Now everything is fine!
Daniel Le Maty
754 PointsThe name flavor should be in the name attribute not the id
<select name="flavor">
<option value="value_here">option 1</option>
<option value="value_here_2">option 2</option>
</select>