Help: Min/Max Input Field

Hello Guys
I have a problem I have a standard php contact form but one of the fields need to have a set character limit of 17 characters. and I can not figure how to do it all it needs to do is just make them put in 17 alphanumeric characters.

the website it is on is quick quote form http://bestcash4yourcar.com

The field that needs to have the set 17 character is VIN

I appreciate any help you may offer!

[code]<?php
$Email = Trim(stripslashes($_POST[‘Email’]));
$EmailTo = "[email protected], [email protected]";
$Subject = “Quick Quote”;
$Name = Trim(stripslashes($_POST[‘Name’]));
$Phone = Trim(stripslashes($_POST[‘Phone’]));
$Make = Trim(stripslashes($_POST[‘Make’]));
$Model = Trim(stripslashes($_POST[‘Model’]));
$Year = Trim(stripslashes($_POST[‘Year’]));
$Miles = Trim(stripslashes($_POST[‘Miles’]));
$Spam = Trim(stripslashes($_POST[‘Spam’]));
$VIN = Trim(stripslashes($_POST[‘VIN’]));
$Message = Trim(stripslashes($_POST[‘Message’]));

// validation
$validationOK=true;
if (Trim($Email)=="") $validationOK=false;
if (Trim($VIN)=="") $validationOK=false;
if (!$validationOK) {
print “<meta http-equiv=“refresh” content=“0;URL=quote_error.html”>”;
exit;
}
if (strtolower($_POST[‘Spam’]) != ‘11’) {print “<meta http-equiv=“refresh” content=“0;URL=spam.html”>”; exit;}

// prepare email body text
$Body = “”;
$Body .= "Name: ";
$Body .= $Name;
$Body .= “\n”;
$Body .= "Email: ";
$Body .= $Email;
$Body .= “\n”;
$Body .= "Phone: ";
$Body .= $Phone;
$Body .= “\n”;
$Body .= "Make: ";
$Body .= $Make;
$Body .= “\n”;
$Body .= "Model: ";
$Body .= $Model;
$Body .= “\n”;
$Body .= "Year: ";
$Body .= $Year;
$Body .= “\n”;
$Body .= "Miles: ";
$Body .= $Miles;
$Body .= “\n”;
$Body .= "VIN: ";
$Body .= $VIN;
$Body .= “\n”;
$Body .= "Spam: ";
$Body .= $Spam;
$Body .= “\n”;
$Body .= "Message: ";
$Body .= $Message;
$Body .= “\n”;

// send email
$success = mail($EmailTo, $Subject, $Body, “From: <$Email>”);

// redirect to success page
if ($success){
print “<meta http-equiv=“refresh” content=“0;URL=quote_ok.html”>”;
}
else{
print “<meta http-equiv=“refresh” content=“0;URL=quote_error.html”>”;
}
?>[/code]

To define what I men by set character limit:

It needs to require the user to input 17 characters and only 17 characters because that is the number of characters in a vehicle vins number.

Thanks Again

Sponsor our Newsletter | Privacy Policy | Terms of Service