Page 1 of 1

Help with syntax

Posted: Tue Sep 14, 2010 10:12 pm
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>;
}
?>

Re: Help with syntax

Posted: Tue Sep 14, 2010 10:17 pm
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