Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

PHP

Can 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
Antonio De Rose
20,882 Points
first 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.

Oh 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?