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 trialJackson Monk
4,527 PointsCan you only get one element from a form with $_POST?
I have a form with two elements I want to use on another page, so I used the 'post' method for the form and retrieved the information on the other page with php's $_POST[] method. The first element I get shows up fine, all the text is there. However the second element I try to get just appears as nothing. Can you only get one element from a form with $_POST[]?
1 Answer
Antonio De Rose
20,885 Pointsfirst of all, what do you mean by an element, in the context of $_POST,
you will be passing values, for input types, and capture it, in the form it is action'd,
with the $_POST
input types, could be of anything like a textbox, textarea, checkbox, radio etc, for all
will be within a form element, and to receive all of what was entered from the above
input types, there have to be a final submit type.
perfect example is here, https://www.w3schools.com/php/php_forms.asp, please do
hit run example and see the result.
Jackson Monk
4,527 PointsJackson Monk
4,527 PointsOh it can only post input types, that would be why its not working. Any way I could use a different method to load my non input type?