I have my errors and thank u msgs in a div below my form, it has padding that makes the bottom of my site look strange since there is nothing there so I put display:none on it. How do I enable it after the form is clicked? heres my form
PHP Code:
<?php
// To better handle Validation errors we need to put the fields into an array for easier handling
$FIELDS = array("Your Name" => "name", "Your Email" => "email", "Your Message" => "txt", "Anti-Spam" => "question");
?>
<form method="post" action="<?php echo $_SERVER['PHP_SELF'];?>#contactform">
<?php
// Get question and answer for Anti-spam
$rand = rand(0,count($QUESTIONS)-1); // randomize question being asked
list($q, $a) = $QUESTIONS[$rand]; // split question and answer up into seperate variables
$_SESSION['answer'] = $a; // Answer for the question gets stored in a SESSION
foreach($FIELDS as $fieldname => $name) {
$style = ""; // Used for changing background color of input field .
// if there are errors we want to change the style of the input boxes to inform user
if(isset($errors) && $errors[$name] == 1) $style = "style=\"border: 1px solid #d25e55;\"";
echo "<div class=\"grp\">";
switch($name) {
case 'txt':
// need a textarea instead of an input box
echo "<label for=\"{$name}\">{$fieldname}</label><br />\n";
echo "<textarea id=\"{$name}\" {$style} name=\"{$name}\" class=\"\" rows=\"\" cols=\"\" onfocus=\"this.style.backgroundColor='#3c3c3f'\" ".
"onblur=\"this.style.backgroundColor='#2d2d30'\" >";
if(isset($_POST[$name])) echo $_POST[$name];
echo "</textarea>\n";
break;
case 'question':
echo "<label for=\"{$name}\">{$q}</label><br />\n";
echo "<input class=\"\" {$style} id=\"{$name}\" type=\"text\" name=\"{$name}\" onfocus=\"this.style.backgroundColor='#3c3c3f'\" ".
"onblur=\"this.style.backgroundColor='#2d2d30'\" />";
break;
default:
echo "<label for=\"{$name}\">{$fieldname}</label><br />\n";
echo "<input class=\"\" {$style} id=\"{$name}\" type=\"text\" name=\"{$name}\" onfocus=\"this.style.backgroundColor='#3c3c3f'\" ".
"onblur=\"this.style.backgroundColor='#2d2d30'\" value=\"";
if(isset($_POST[$name])) echo $_POST[$name];
echo "\" />\n";
break;
}
echo "</div>";
}
?>
<div class="grp2">
<input class="formsubmit" type="submit" value="Submit" name="submit" />
</div>
</form>
</div>
</div>
<div id="ereport">
<p>
<?php
// If errors found display DIV block
if(isset($errMsg)) echo $errMsg;
// If form successfully submitted, thank the user.
if(isset($_GET['thankyou'])) {
echo $THANKYOU;
}
?>
</p>
</div>
what would I change the display to so it works? and is this where I would do it?