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 trial

PHP

When I submit my form empty, instead of giving me an error msg for the name,email, etc; it gives me an error for the Original price. What am I doing wrong here? is there an easier way?

<?php
if ($name == "" or $email == "" or $phone == "" or $time == "") { ?> <script type="text/javascript"> alert("Please don't forget your personal info: Name, Email, Number, and best time to contact you."); history.back(); </script> <?php }

if (!$hidden == "") { ?> <script type="text/javascript"> alert("You have submitted your information in error. Please submit again."); history.back(); </script> <?php }

if ($org_price == ""){ ?> <script type="text/javascript"> alert("Please input Original note price."); history.back(); </script> <?php }

if ($down_payment == ""){ ?> <script type="text/javascript"> alert("Was there a down payment?"); history.back(); </script>; <?php }

1 Answer

it doesn't show but the alert boxes are wrapped in the script tag with type= text/javascript