Remove Paragraph Element ?
Posted: Tue Sep 14, 2010 8:58 pm
Hey guys,
Ok, So I'm using a simple mailer script with a form. The form is validated very simply using PHP. On the form is a submit button, when this is clicked the form elements are validated, if the form is valid the email is sent and a message , if not an error message is displayed below the form. Simple. Below the form is a paragraph, a simple HTML paragraph, when the submit button is clicked I want this paragraph to become hidden, I know I can do this using Jquery or JS but seeing as the page is refreshed when the button is clicked this paragraph never remains hidden. I know there is probably a solution using PHP and I know it is probably fairly simple, but I cannot figure it out. Shown below is the code that outputs the error or success message when the form is submitted, along with the paragraph in question. I guess my question is how I would go about integrating the paragraph, also shown below into this to pretty much become hidden when these messages need to be displayed, but appear on the page when the form is doing nothing, as in, when a visitor firsts visit the page. I hope that make sense, let me know if there is anything you guys dont understand,
<p class="error">Need this paragraph to become hidden</p>
Ok, So I'm using a simple mailer script with a form. The form is validated very simply using PHP. On the form is a submit button, when this is clicked the form elements are validated, if the form is valid the email is sent and a message , if not an error message is displayed below the form. Simple. Below the form is a paragraph, a simple HTML paragraph, when the submit button is clicked I want this paragraph to become hidden, I know I can do this using Jquery or JS but seeing as the page is refreshed when the button is clicked this paragraph never remains hidden. I know there is probably a solution using PHP and I know it is probably fairly simple, but I cannot figure it out. Shown below is the code that outputs the error or success message when the form is submitted, along with the paragraph in question. I guess my question is how I would go about integrating the paragraph, also shown below into this to pretty much become hidden when these messages need to be displayed, but appear on the page when the form is doing nothing, as in, when a visitor firsts visit the page. I hope that make sense, let me know if there is anything you guys dont understand,
<p class="error">Need this paragraph to become hidden</p>
Code: Select all
<?php if(isset($hasError)) { //If errors are found ?>
<p class="error" style="color:blue;">Error. Please check that you've filled all the fields with valid information.</p>
<?php } ?>
<?php if(isset($emailSent) && $emailSent == true) { //If email is sent ?>
<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>
<?php } ?>