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 trialNoah A
4,144 PointsSend email in same file -- not sending (code included)
Code
if ($_POST["update"]
{
mail("test@test.com", "A Test Subject", "A Test Message");
}
Form Submission
<input type="submit" name="update" value="Some Value">
I have the Code included at the top of the file, and the form submission is towards the very bottom. Also, the form is method="post"
My understanding is that $_POST[#{name}] gets matches the value of any submit input, and matches the name of the input; therefore, using an if statement checking if ($_POST[#{name})
matches the name of the submit input, then it'll execute whatever is inside.
In the end, my email is not sending. Any feedback, Treehouse community PHPers? Thanks!
1 Answer
Matthew Bilz
15,829 PointsDoes your production code at the top have the closing parenthesis on
if ($_POST["update"]
? That would cause a fatal error.