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.
Jon Benham6,444 Points
Email Form always defaulting to "Please fill in the required fields: Name, Email and Details"
I seem to be having trouble with submitting the email, whatever I do the code resorts to the first 'if' statement and outputs "Please fill in the required fields: Name, Email and Details".
I feel like I have followed the videos and code closely but clearly I am missing something somewhere!
Can anyone help?
I have attached a snapshot of my code here https://w.trhou.se/7b2vlx13lj
In suggest.php I added the following before your if statement:
echo $name . " " . $email . " " . $details;
and found that $details was blank
If you go to line 80 you'll find the name is details where it should be address
<td><input type="text" name="details" id="address">
<td><input type="text" name="address" id="address">
Pascal BreitrückCourses Plus Student 3,205 Points
fix the name propertie on the input field for the address . There is details set and this will overwrite the details in a blank field.
<td><input type="text" name="address" id="address" value="">
Ps. Use the var_dump() func. to debug things ;D like the $_POST :D