Help with syntax

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Riza
Forum Newbie
Posts: 2
Joined: Tue Sep 14, 2010 8:36 pm

Help with syntax

Post by Riza »

I need help inserting the correct syntax to make my snippet of code work correctly. It will work when the messages are output using echo only and not wrapped in tags. Can anyone pelase help me out with inserting correct syntax as I am not familiar with it. Thanks !

Code: Select all

<?php
 if(isset($hasError)) {
    echo <p class="error" style="color:blue;">Error. Please check that you've filled all the fields with valid information.</p>
} elseif (isset($emailSent) && $emailSent == true) {
  echo <p style="padding-bottom:4px;">Thank you <strong><?php echo $name;?></strong> for contacting us! A representative will be in contact with you in 1-2 business days. </p>;
} else {
    echo <p class="error">We'll call you shortly! This information is confidential and will never be used for marketing purposes.</p>;
}
?>
User avatar
Jonah Bron
DevNet Master
Posts: 2764
Joined: Thu Mar 15, 2007 6:28 pm
Location: Redding, California

Re: Help with syntax

Post by Jonah Bron »

Code: Select all

<?php
 if(isset($hasError)) {
    echo '<p class="error" style="color:blue;">Error. Please check that you've filled all the fields with valid information.</p>';
} elseif (isset($emailSent) && $emailSent == true) {
  echo '<p style="padding-bottom:4px;">Thank you <strong>' . $name . '</strong> for contacting us! A representative will be in contact with you in 1-2 business days. </p>';
} else {
    echo '<p class="error">We\'ll call you shortly! This information is confidential and will never be used for marketing purposes.</p>';
}
?>
You might want to do some research on strings and their syntax. Read this link from the manual.

http://us3.php.net/manual/en/language.types.string.php
Post Reply