Hello
http://www.sprayfluxing.com/contact/contactform.php
the form above will not validate if you enter a correct validation number(txtNumber in the php code) so you could leave name and email blank and just enter the number and the form will process and submit to email.. Ive tried several different things and Im lost I know the solution is right there but I just cant seem to figure it out. Its a self validating form.... here is the code
<?PHP
session_start();
@extract($_POST);
//pull from contact list page
$emailaddy = $_POST['emailaddy'];
$emailaddy2 = $_POST['emailaddy2'];
$emailaddy3 = $_POST['emailaddy3'];
$emailaddy4 = $_POST['emailaddy4'];
$emailaddy5 = $_POST['emailaddy5'];
$emailaddy6 = $_POST['emailaddy6'];
$emailaddy7 = $_POST['emailaddy7'];
//variables to send email
$sendto = $_POST['sendto'];
$subject = "Spray Fluxing.com Contact Form Submission";
$emailsubject = $_POST['emailsubject'];
$name = $_POST['name'];
$email = $_POST['email'];
$comments = $_POST['comments'];
$body = "Name: $name\nEmail: $email\nSubject: $emailsubject\nComments:\n$comments\n";
$nameerror = "";
$emailerror = "";
$validerror = "";
//display who email is going to
if ($_POST['emailaddy']) {
$emailvalue = 'asousa@sono-tek.com';
$toheader = 'Steve Harshbarger';
}
if ($_POST['emailaddy2']) {
$emailvalue = 'asousa@sono-tek.com';
$toheader = 'Vincent Whipple';
}
if ($_POST['emailaddy3']) {
$emailvalue = 'asousa@sono-tek.com';
$toheader = 'Luis Abarca';
}
if ($_POST['emailaddy4']) {
$emailvalue = 'asousa@sono-tek.com';
$toheader = 'Claudine Corda';
}
if ($_POST['emailaddy5']) {
$emailvalue = 'asousa@sono-tek.com';
$toheader = 'Robb Engle';
}
if ($_POST['emailaddy6']) {
$emailvalue = 'asousa@sono-tek.com';
$toheader = 'Christopher L. Coccio';
}
if ($_POST['emailaddy7']) {
$emailvalue = 'asousa@sono-tek.com';
$toheader = 'for more information';
}
session_register("emailvalue");
session_register("toheader");
session_register("name");
session_register("email");
//type of email
$header = "MIME-Version: 1.0\r\n";
$header .= "Content-type: text/plain; charset=iso-8859-1\r\n";
$header .= "From: $name <$email>";
//validate random validation number and if name and email were entered
if (isset($_POST['txtNumber'])) {
if (empty($name)){
$nameerror = "<tr>
<td colspan=2 class=emptyfield>! Please provide your name !</td>
</tr>";
} if (empty($email)) {
$emailerror = "<tr>
<td colspan=2 class=emptyfield>! Please provide your email !</td>
</tr>";
$emailvalue = $emailvalue;
}
$number = $_POST['txtNumber'];
if (md5($number) == $_SESSION['image_random_value']) {
//mail the form to the correct email
mail($sendto,$subject,$body,$header);
header("location:http://www.sprayfluxing.com/contact/thanks.php");
exit();
} else {
$validerror = "<tr>
<td colspan=2 class=emptyfield>! You must enter the CORRECT Validation Number to continue !</td>
</tr>";
$emailvalue = $emailvalue;
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Spray Fluxing Information in Spanish</title>
<META NAME="KEYWORDS" CONTENT="spray fluxing, precision spraying, flux coating, spray fluxers, fluxing systems, spraying, precision coatings">
<META NAME="description" CONTENT="Spray Fluxing from Sono-Tek for spray fluxers for PCBs, BGAs and other components.">
<style type="text/css">
body {
font-family: Arial, Helvetica, sans-serif;
background-color:#336666;
background-image:url(../images/_layout/_bg_green.jpg);
margin: 0;
}
#maintable {
width: 680px;
background-color:#FFFFFF;
}
#menu {
background-image: url(../images/_layout/_bg_fluxleftmenu.jpg);
width: 152px;
vertical-align: top
}
#contenttable {
background-color:#FFFFFF;
vertical-align: top;
font-size: 12px;
}
.bgcolor {
background-color: #FFFFFF;
font-size:10px;
}
a {
text-decoration: none;
}
#footercopyright {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
background-color:#FFFFFF;
text-align: center;
}
.foreignlang {
font-size: 9px;
width: 56%;
}
.smallfont {font-size: small}
#webcontact {
font-size: 12px;
font-style: italic;
padding-left: 15px;
}
#toheader {
font-size: 12px;
text-align: center;
font-weight: bold;
}
#contentcell {
vertical-align: top;
width: 528px;
}
.required {color: #FF0000;
font-size: 11px;
font-weight: bold;
text-align: left;
}
.emptyfield {
font-size: 12px;
color: #FF0000;
font-weight: bold;
}
-->
</style>
<script language="javascript" src="../_menucode/phpmenu.js"></script>
<script language="javascript" src="../_menucode/mm_menu.js"></script>
</head>
<body onLoad="MM_preloadImages('../images/_layout/_fluxleftmenu2-over.jpg','../images/_layout/_fluxleftmenu3-over.jpg','../images/_layout/_fluxleftmenu4-over.jpg','../images/_layout/_fluxleftmenu5-over.jpg','../images/_layout/_fluxleftmenu6-over.jpg','../images/_layout/_fluxleftmenuevs-over.jpg','../images/_layout/_fluxleftmenu7-over.jpg','../images/_layout/_fluxleftmenu8-over.jpg','../images/_layout/_fluxleftmenu9-over.jpg','../images/_layout/_fluxleftmenu10-over.jpg','../images/_layout/_fluxleftmenu11-over.jpg')">
<script language="JavaScript1.2">mmLoadMenus();</script>
<a name="top_anchor"></a>
<table cellpadding="0" cellspacing="0" id="maintable">
<tr>
<td colspan="2"><img src="../images/_banner_sprayflux.jpg" alt="Spray Fluxing.com" /></td>
</tr>
<tr>
<td id="menu" rowspan="4">
<img src="../images/_layout/_fluxleftmenu1.jpg" alt="" /><br />
<? include("../menu.html"); ?>
<br />
<form action="http://www.sono-tek.com/cgi-bin/search/lightning_search.cgi" method="post">
<input type="hidden" name="action" value="search">
<div align="center">
<INPUT TYPE="text" name="keywords" size=16>
<input name="submit" type="submit" value="Search">
</div>
</form>
<br />
**<img src="../images/_layout/ce.gif" width="47" height="35"> <img src="../images/_layout/iso9001.jpg" width="82" height="28"><br>
<br>
<img src="../images/_layout/pbfree.jpg" width="71" height="71" hspace="38">
<td align="center" id="contentcell">
<form action="contactform.php" method="post">
<input type="hidden" name="sendto" value="<? print "$emailvalue"; ?>" />
<table id="contenttable" cellpadding="0" cellspacing="0">
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td colspan="2" id="toheader">To email <font color="#FF0000"><? print $toheader; ?></font> please fill out and submit the form below.</td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td class="required" colspan="2">** INDICATES REQUIRED FIELD</td>
</tr>
<?
if ($nameerror != "") {
print "$nameerror";
}
?>
<tr>
<td class="required">Name **</td>
<td><input type="text" name="name" size="33" value="<? print "$name"; ?>" /></td>
</tr>
<?
if ($emailerror != "") {
print "$emailerror";
}
?>
<tr>
<td class="required">Email **</td>
<td><input type="text" name="email" size="33" value="<? print "$email"; ?>" /></td>
</tr>
<tr>
<td align="left">Subject</td>
<td><input type="text" name="emailsubject" size="33" /></td>
</tr>
<tr>
<td align="left" colspan="2">Comments</td>
</tr>
<tr>
<td colspan="2"><textarea name="comments" rows="10" cols="40"></textarea></td>
</tr>
<?
if ($validerror != "") {
print "$validerror";
}
?>
<tr>
<td align="right">Validation Number:</td>
<td align="left"> <img src="../info/randomimage.php" /></td>
</tr>
<tr>
<td align="right" class="required">Please Enter the Validation Number:</td>
<td align="left"> <input type="text" name="txtNumber" size="5" /></td>
</tr>
<tr>
<td colspan="2"><input type="submit" name="submit" value="Submit" /> <input type="reset" name="reset" value="Clear Form" /></td>
</tr>
</table>
</form>
</td>
</tr>
<tr>
<td id="webcontact">Questions or comments about this site? Contact the <a href="http://www.sono-tek.com/forms/webmaster.php">Webmaster.</a></td>
</tr>
<tr>
<td class="bgcolor"><a href="#top_anchor"><img src="../images/_bottom_bar.gif" border="0" alt="" /></a></td>
</tr>
<tr>
<td id="footercopyright"><table cellspacing="0" cellpadding="0">
<tr>
<td>©
Copyright 2002 Sono-Tek Corporation </td>
<td> <a href="http://www.sono-tek.com/sitemap.php">Site
Map</a> |<a href="../legal">Legal Information</a> | <a href="../legal/privacy.php">Privacy
Statement</a></td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>
The validation is at the top pretty much the only thing in the body of the html is displaying the errors. Please let me know.
As always Thanks! 🙂
Antoni