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 trialnopenoname
1,515 PointsStyle the error page?
Is there a way to add style (or at least margins) to the "You must specify a value for name, email address, and message." error message?
1 Answer
Erik McClintock
45,783 PointsValerie,
If you want to style your error message, you could easily allow for that by echoing out some HTML elements with an ID or class to encapsulate the message itself.
For example, rather than simply doing this:
if($name == "") {
echo "You must specify a value for name.";
exit;
}
You could do this:
if($name == "") {
echo '<span id="error_message">You must specify a value for name.</span>';
exit;
}
And then target the span with an ID of "error_message" in your CSS.
Erik
nopenoname
1,515 Pointsnopenoname
1,515 PointsAh, thank you very much!