I have created my form
I have captcha working
I have errors working but I can’t for the life of me get my errors in a nice box. I have tried errorbar and it works but it also auto appears and when I switch auto off the box does not show and errors are on top of html.
Here is nice error box
jQuery(document).ready(function(){
$( ".errorbar:ui-dialog" ).dialog( "destroy");
$( ".errorbar" ).dialog({
width: 500,
modal: true,
buttons: {
Ok: function() {
$( this ).dialog( "close" );
}
}
});
});
Here is the div that displays it when form is not complete.
<div class="errorbar" title="Oops! There's something missing">
<?php
if ($errors) {
echo "<br />";
echo "<span style='color:$error_color'><br />$errors</span>";
}
?>
</div>
Here are my $errors
$errors=“”;
$message_sent=false;
function validate_email($email) {
return preg_match(‘/[1]+@[A-Za-z0-9_\-\.]+\.[A-Za-z0-9_\-\.]+$/’, $email) == 0;
}
if ($_SERVER[‘REQUEST_METHOD’] == ‘POST’)
{
if ($use_security_image && (strtolower($security_code) != strtolower($_SESSION[‘securimage_code_value’]) || $_SESSION[‘securimage_code_value’]==‘’) ) {
$errors.=“The verification code for the image presented was incorrect. Please enter a correct verification code.<br/><br/>”;
}
if ($visitor_name == ‘’)
$errors.=“Please enter your name<br/><br/>”;
if (validate_email($visitor_email) ) {
$errors.=“Please enter a valid email address in the form of user@place.ext<br/><br/>”;
}
if ($message_subject == ‘’)
$errors.=“Please enter a subject<br/><br/>”;
if ($message_body == ‘’)
$errors.=“Please enter a message<br/><br/>”;
if ( !$errors ) {
$ip = $_SERVER[“REMOTE_ADDR”];
$httpagent = $_SERVER[“HTTP_USER_AGENT”];
$time = date(“D, F j, Y H:i O”);
if ($visitor_name)
$visitor_name_and_email=“$visitor_name <$visitor_email>”;
else
$visitor_name_and_email=“$visitor_email”;
if ($contact_from_name)
$contact_from_email=“$contact_from_name <$contact_from_email>”;
$message = "
$message_body
Browser Info: $ip $httpagent
";
if ($send_from_internal_address) {
$message= "
From: $visitor_name_and_email
Date: $time
Subject: $message_subject
".$message;
}
if ($send_from_internal_address) {
mail($contact_to_email, $contact_subject." $message_subject", $message, “From: $contact_from_email\r
Reply-To: $visitor_name_and_email”);
}
else {
mail($contact_to_email, $contact_subject." $message_subject", $message, “From: $visitor_name_and_email”);
}
echo “<div style='background-color: #138620;
border-style:inset;
border-color:#174009;
border-width:5px;
width:400px;
height:150px;
position: absolute;
top:200px;
left:80px;
z-index:25;
color: #ffffff;
font-family: sans-serif;
font-size: medium;
font-weight: bold;
font-style: italic;
margin: 10px 10px 10px 10px; padding: 10px 10px 10px 10px;
'>Your message…<p>”;
echo “From: “.htmlentities($visitor_name_and_email).”<p>Re: “.htmlentities($message_subject).”<p>”;
echo “Has been sent. Thank you for contacting us.</div>”;
$message_sent=true;
}
}
if (!$message_sent) {
$this_file = substr(strrchr($_SERVER[‘PHP_SELF’], “/”), 1);
?>
Once again this is what happens.
If I use errorbar - it shows up at page open - if I set it not to open when I submit it doesn't open and the messages are strewn in my page with no nice box.
I have added my ugly page as an attachment see if you can make some sense of it named it .txt instead of .php.
Please HELP
I haven't even got to message sent box.
A-Za-z0-9_\-\. ↩︎