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

Help with var_dump

Hello guys,

Present i'm at [http://teamtreehouse.com/library/programming/build-a-simple-php-application/adding-a-contact-form/working-with-post-variables] And i have a quick question.my form has correct HTML.i used Following code in contact-process.php to display form data

<?php var_dump($_POST); ?>

But when i submit the form i'm getting array(0) { }

But not data.Any suggestions?? Randy Hoyt Zac Gordon

3 Answers

Randy Hoyt
STAFF
Randy Hoyt
Treehouse Guest Teacher

Two questions:

(1) Does your form have a method attribute of post?

<form method="post">

(2) Do your form fields have name attributes?

<input type="text" name="message">

I suspect one of those is missing.

Does that help?

Hai Randy,

thanks for the reply, I appreciate it :) Sorry.. My fault.I missed name attributes.Thanks again :)

Cheers

I am having the same problem with a returned array{0}. I have a method attribute of post, and form fields that have name attributes. please help.