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 trialMarco Otto
5,342 PointsbRaKinG MADE: No line break "\n" :-(
Why does'nt the Preview of the workspace show line breaks?
<?php $name = $_POST["name"]; $email = $_POST["email"]; $details = $_POST["details"];
echo "Name " . $name . "\n"; echo "E-Mail " . $email . "\n"; echo "Details " . $details . "\n"; ?>
2 Answers
Kane Simmons
14,206 PointsHey Marco I believe you forgot to echo the <pre> tag before and </pre> closing tag after you echo your variables. Good luck!
Marco Otto
5,342 PointsHi Kane,
ok thanks! Did not know that \n only works within the HTML-tag pre like this:
<?php
$one = "1";
$two = "2";
echo "<pre>";
echo "foo:" .$one. "\n";
echo "boo:" .$two. "\n";
echo "</pre>";
?>
If I dont wanna use the tag: <pre> I use </br> instead:
<?php
$one = "1";
$two = "2";
echo "foo:" .$one. "</br>";
echo "boo:" .$two. "</br>";
?>
Now I got it! :-)
Kane Simmons
14,206 PointsKane Simmons
14,206 PointsSorry, I typed that wrong, you're supposed to echo an html tag called pre before and after you echo your variables