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
markzerba
2,481 Pointsxampp working?
I tried to replicate the contact form submission following the lesson in the beginner PHP lesson. I have a form with three text inputs. The method is post. Name, email and phone are the matching names in the 3 text inputs. The code in the submission page I've got is:
<?php
$name = $_POST["name"];
$email = $_POST["email"];
$phone = $_POST["phone"];
echo $name;
echo $email;
echo $phone;
?>
However, when I submit the form I'm getting these notices that I can't seem to get rid of.
Notice: Undefined index: name in C:\XamppProgram\htdocs\inquirysubmit.php on line 2
Notice: Undefined index: email in C:\XamppProgram\htdocs\inquirysubmit.php on line 3
Notice: Undefined index: phone in C:\XamppProgram\htdocs\inquirysubmit.php on line 4
I also tried running a var_dump($POST); to pull the information from the form and I get an empty array. array(0) { } I would expect to see all the info without white space.
Is Xampp running properly on my computer or am I missing something else? Appreciate anyone's help!
3 Answers
markzerba
2,481 PointsThanks Justin. I actually figured it out this morning. There was a syntax error in the form heading. I guess I didn't think anything would send with that type of error. Thanks for your response anyway!
Justin Carlson
12,755 Pointswhat does your contact form look like? looks like they are just not being set when you post from the form,
Justin Carlson
12,755 PointsGlad you got it sorted :-)