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 trialPhil White
Courses Plus Student 9,519 PointsPHP code at top of page?
Hi,
I'm currently doing the PHP track and everything is going well but when the page loads it has the normal page but then at the top it is showing the code like "array(3) => string (4) => string (17) and so on.
How do i make it so this doesn't show?
Thanks in advance
3 Answers
Jeffrey van Rossum
2,994 PointsYou have to remove this:
Jeffrey van Rossum
2,994 PointsI'd have to see your code to be sure, but you might want to search for 'print_r' in your code.
Phil White
Courses Plus Student 9,519 PointsHeres my code:
<?php
var_dump($_POST);
$name = $_POST["name"];
$email = $_POST["email"];
$message = $_POST["message"];
$email_body = "";
$email_body = $email_body . "Name: " .$name . "\n";
$email_body = $email_body . "Email: " .$email . "\n";
$email_body = $email_body . "Message: " .$message;
echo $email_body;
$pageTitle = "Contact Mike";
$section = "contact";
include("inc/header.php");
?>
<div class="section page">
<div class="wrapper">
<h1>Contact</h1>
<p> Thanks for the email! i’ll be in touch shortly.</p>
</div>
</div>
<?php include("inc/footer.php"); ?>
Phil White
Courses Plus Student 9,519 PointsPhil White
Courses Plus Student 9,519 PointsOk thanks done that but now it is showing the input like Name: Email: Message: ?
Kevin Korte
28,149 PointsKevin Korte
28,149 PointsThat's coming from the
echo $email_body
line. Remove that too.Phil White
Courses Plus Student 9,519 PointsPhil White
Courses Plus Student 9,519 PointsAwesome Thanks! The helps appreciated!