
<?php
$QUIZ1 = 2 + 2;
$QUIZ1TXT = '2 + 2 =';
$QUIZ1ANS = '4';

$QUIZ2 = 4 + 6;
$QUIZ2TXT = '4 + 6 =';
$QUIZ2ANS = '10';

$QUIZ3 = 8 + 1;
$QUIZ3TXT = '8 + 1 =';
$QUIZ3ANS = '9';

$n = rand(1, 3);;

$QUIZ = "$QUIZ$n";

if ($n == 1) {
$QUIZTXT = $QUIZ1TXT;
$QUIZANS = $QUIZ1ANS;
}

if ($n == 2) {
$QUIZTXT = $QUIZ2TXT;
$QUIZANS = $QUIZ2ANS;
}

if ($n == 3) {
$QUIZTXT = $QUIZ3TXT;
$QUIZANS = $QUIZ3ANS;
}
?>
<script language="JavaScript" type="text/javascript">
<!-- Begin
function verify() {
        var themessage = "The following fields can not be blank : ";

        if (document.FieldName.NAME.value=="") {
                themessage = themessage + " | Name";
        } if (document.FieldName.EMAIL.value=="") {
                themessage = themessage + " | Email";
        } if (document.FieldName.MESSAGE.value=="") {
                themessage = themessage + " | Message";
        

        } if (document.FieldName.QUIZ.value!="<?php echo $QUIZANS; ?>") {
                themessage = themessage + " | Answer Incorrect";
        }

if (themessage == "The following fields can not be blank : ") {
                document.FieldName.submit();
        } else {
                alert(themessage);
                return false;
        }
        }
//  End -->
</script>

<form name="FieldName" method="post" action="?page=contact&email=1">
<table width="100%" cellpadding="0" cellspacing="0" border="0" align="center">
<tr> 
<td> 
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr> 
<td class="td4"> <img src="images/Mail-icon.png" width="114" height="80"></td>
<td class="td4" width="100%"> 
<div align="right">
<?php $description = preg_replace("/\n/","\n<BR>",$rowxxx[CONTACTTEXT]); ECHO $description; ?>
</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
<table  width="100%" cellpadding="0" cellspacing="0" border="0">
<tr> 
<td class="td6" width="100%">&nbsp; </td>
</tr>
</table>
<br>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr> 
<td width="50%" class="td4">Your Name</td>
<td width="50%" class="td4"> <span class="padding5"><span class="textclass1"><b> 
<input type="text" class="textarea100" name="NAME" size="40">
</b></span></span></td>
</tr>
<tr> 
<td class="td4" width="50%">Your Email Address</td>
<td class="td4" width="50%"><span class="padding5"><span class="textclass1"><b> 
<input type="text" class="textarea100" name="EMAIL" size="40">
</b></span></span> </td>
</tr>
<tr> 
<td class="td4" width="50%">Subject</td>
<td class="td4" width="50%"><span class="padding5"><span class="textclass1"><b> 
<input type="text" class="textarea100" name="SUBJECT" size="40">
</b></span></span> </td>
</tr>
<tr> 
<td class="td4" width="50%">Message</td>
<td class="td4" width="50%"><span class="padding5"> 
<textarea name="MESSAGE" cols="40" rows="6" class="textarea100"></textarea>
</span></td>
</tr>
<tr> 
<td class="td4" width="50%"> Are you Human?</td>
<td class="td4" width="50%"><b> 
<?php echo $QUIZTXT; ?>
<input type="text" name="QUIZ" size="6">
</b></td>
</tr>
<tr> 
<td class="td4" width="50%">&nbsp;</td>
<td class="td4" width="50%"> 
<input type="button" value="Send Email" onClick="verify();" />
<?PHP if ($_GET[email] == 1) { ?>
<?php 
$message = preg_replace("/\n/","\n<BR>",$_POST[MESSAGE]);
sendmail("$rowxxx[EMAIL]", "$_POST[EMAIL]","$_POST[SUBJECT]","$message<br><br>$emailsig"); 
?>
<b>Your message has been sent!</b> 
<?PHP } ?>
</td>
</tr>
</table>
</form>
