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!
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 !
<?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>;
}
?>
<?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.