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 trialGenevieve Tan
4,257 Pointsunable to echo message properly
Hi, I am able to echo var_dump name and email, however when i add message , the entire page goes blank. This is the section of my html code on the contact form.
<form method="post" action="contact-process.php"> <table> <tr> <th> <label for="name">Name</label> </th> <td> <input type ="text" name="name" id="name"> </td> </tr> <tr> <th> <label for="email">Email</label> </th> <td> <input type ="text" name="email" id="email"> </td> </tr> <tr> <th> <label for="message">Message</label> </th> <td> <textarea name="message" id="message"></textarea> </td> </tr> </table> <input type="submit" value="send"> </form>
And this is the code for my contact-process.php
<?php echo 'Tan'; var_dump($_POST); $name = $_POST["name"]; echo $name; $email = $_POST["email"]; echo $email; /$message = $_POST["message"] echo $message;/
?>
It runs perfectly until i uncomment the message variable. I don't understand whats wrong. Help
Jeff Lemay
14,268 PointsWon't be the last time! :)
3 Answers
Jeff Lemay
14,268 PointsNo semi-colon after $_POST["message"]
Genevieve Tan
4,257 PointsYes :(( Thank you!
Kristoffer Lund
11,133 PointsYou are missing a semi colon after $_POST["message"].
Genevieve Tan
4,257 PointsYes :(( Thank you!
smokie
3,365 PointsDont you need a semicolon after the statement loading $message? $message = $_POST["message"]; <-- Semicolon here echo $message;
Genevieve Tan
4,257 PointsYes :(( Thank you!
Genevieve Tan
4,257 PointsGenevieve Tan
4,257 PointsOpps i realised i missed a semi colon. Cost me 1 hr to find it T.T