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

PHP Build a Basic PHP Website (2018) Adding a Basic Form Working with Post Variables

Carlos Federico Puebla Larregle
Carlos Federico Puebla Larregle
21,074 Points

It appears an empty array with no data in it. I don't know what I'm doing wrong.

I put the "action=process.php" property in the form tag then I created the php file with the same name, just like the professor did. Then I put the "<?php var_dump($_POST); ?>" code, send it again but it appears an empty array instead of the array with all the information submitted.

3 Answers

I guess your problem is now solved but for the one's who might come back to this discussion for a similar problem,

Make sure that the name="" of your input corresponds to the name you declare in your $_POST[""] variable. Otherwhise the input value will be defined as Null.

<td><input type="text" id="email" name="usermail"/></td>
$email = $_POST["email"];
// Here the value will be Null because we look for the name "useremail", not "email" in our input form. 

Hope it will help some of you =)

Carlos Federico Puebla Larregle
Carlos Federico Puebla Larregle
21,074 Points

Thank you very much Murat, I had a sintax error in that line.