RIRedinPA Posted December 19, 2008 Share Posted December 19, 2008 actually I'm not sure if this question belongs here or in the Apache area. I am validating a form using AJAX and PHP. Everything works fine except I need to validate urls submitted with http, https or ftp in the string. When I type in www.test.com the form validates correctly and gives me an error. However, when I stick http://www.test.com into the string I get a Forbidden error message from the server. I'm pretty sure the // is messing things up. Should I escape that and if so how? Thanks, code follows, feel free to comment in general on it if you'd like. Form: <html> <head> <title>NASVF Test Form</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <script language="javascript"> function validateform(objname) { //get form values var theform = document.makeaccount; var theformvalues = "?"; for(var x=0; x<theform.elements.length; x++) { if (x == 1) { //get text values if (theform.elements[x].type == "text") { theformvalues += theform.elements[x].name + "=" + theform.elements[x].value; } else if (theform.elements[x].type == "textarea") { theformvalues += theform.elements[x].name + "=" + theform.elements[x].value; } else if (theform.elements[x].type == "select-one") { var formIndex = theform.elements[x].selectedIndex; var dropdownvalue = theform.elements[x].options[formIndex].value; theformvalues += theform.elements[x].name + "=" + dropdownvalue; } } else { //get text values if (theform.elements[x].type == "text") { theformvalues += "&" + theform.elements[x].name + "=" + theform.elements[x].value; } else if (theform.elements[x].type == "textarea") { //alert(theform.elements[x].name + "\n" + theform.elements[x].value); theformvalues += "&" + theform.elements[x].name + "=" + theform.elements[x].value; } else if (theform.elements[x].type == "select-one") { var formIndex = theform.elements[x].selectedIndex; var dropdownvalue = theform.elements[x].options[formIndex].value; theformvalues += "&" + theform.elements[x].name + "=" + dropdownvalue; } } } //alert(theformvalues); var xmlHttp = checkajax(); xmlHttp.onreadystatechange=function() { if(xmlHttp.readyState==4) { document.getElementById("nasvfform").innerHTML = xmlHttp.responseText; } } xmlHttp.open("GET","validateform.php" + theformvalues + "&formname=" + objname ,true); xmlHttp.send(null); } function confirmform() { alert("This will be where the form data gets uploaded to the database. I'm going to change the confirm stuff to a form so users can change any mistakes. I will also be validating for phone numbers, email addresses and urls but I'm done for the day cause I am beat. Ha!"); } function checkajax() { var xmlHttp; try { // Firefox, Opera 8.0+, Safari xmlHttp=new XMLHttpRequest(); } catch (e) { // Internet Explorer try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { alert("Your browser does not support AJAX!"); return false; } } } return xmlHttp; } </script> <style type="text/css"> <!-- body { margin: 0px; font-family: arial, helvetica, sans-serif; font-size: 12px; color: #333; } #nasvfform { position: relative; top: 40px; left: 40px; } #nasvfform form { width: 400px; padding: 3px; font-size: 10px; font-weight: normal; } #nasvfform fieldset { font-size: 15px; font-weight: bold; font-style: italic; color: #070719; } #nasvfform label { font-size: 12px; font-weight: bold; color: #070719; font-style: normal; } #nasvfform select { margin-top: 4px; font-style: normal; } #nasvfform input { margin-top: 4px; font-style: normal; } #nasvfform a { margin-top: 4px; font-style: normal; text-decoration: none; } #nasvfform a:link { margin-top: 4px; font-style: normal; text-decoration: none; } #nasvfform a:visited { margin-top: 4px; font-style: normal; text-decoration: none; } #nasvfform a:hover { margin-top: 4px; font-style: normal; text-decoration: none; color: #61380B; } #nasvfform a:active { margin-top: 4px; font-style: normal; text-decoration: none; } --> </style> </head> <body> <?php include "lib/arrays.php"; ?> <div id="nasvfform"> <form name="makeaccount" action="nasvfform.php" method=POST> <fieldset> <legend> NASVF Sign Up Form Demo </legend> <label for "Salutation">Salutation</label><br> <select name="Salutation" id="Salutation"> <option value="null">Select One</option> <option value="Mr.">Mr.</option> <option valur="Mrs.">Mrs.</option> <option value="Ms.">Ms.</option> <option value="Dr.">Dr.</option> </select> <p> <label for "FirstName">First Name</label><br> <input type="text" name="FirstName" size="20"> <p> <label for "MiddleName">Middle Name</label><br> <input type="text" name="MiddleName" size="20"> <p> <label for "LastName">Last Name</label><br> <input type="text" name="LastName" size="20"> <p> <label for "SuffixName">Suffix</label><br> <input type="text" name="SuffixName" size="20"> <p> <label for "NickName">Nick Name</label><br> <input type="text" name="NickName" size="20"> <p> <label for "JobTitle">Job Title</label><br> <input type="text" name="JobTitle" size="20"> <p> <label for "CompanyName">Company Name</label><br> <input type="text" name="CompanyName" size="20"> <p> <label for "Department">Department</label><br> <input type="text" name="Department" size="20"> <p> <label for "BusinessAddress">Business Address</label><br> <textarea name="BusinessAddress" rows=5 cols=20></textarea> <p> <label for "DirectPhoneNumber">Direct Phone Number (Enter as ###-###-####)</label><br> <input type="text" name="DirectPhoneNumber" size="20"> <p> <label for "OfficePhoneNumber">Office Phone Number(Enter as ###-###-####)</label><br> <input type="text" name="OfficePhoneNumber" size="20"> <p> <label for "MobileNumber">Mobile Number (Enter as ###-###-####)</label><br> <input type="text" name="MobileNumber" size="20"> <p> <label for "FaxNumber">Office Fax Number (Enter as ###-###-####)</label><br> <input type="text" name="FaxNumber" size="20"> <p> <label for "EmailAddress">Email Address (Enter as [email protected])</label><br> <input type="text" name="EmailAddress" size="20"> <p> <label for "Website">Web Site (Must begin with http, https, or ftp)</label><br> <input type="text" name="Website" size="20"> <p> <label for "Notes">Notes</label><br> <textarea name="Notes" rows=10 cols=20></textarea> <p> <label for "Biography">Biography</label><br> <textarea name="Biography" rows=15 cols=20></textarea> <p> <label for "AssistantName">Assitant's Name</label><br> <input type="text" name="AssistantName" size="20"> <p> <label for "AssistantOfficePhone">Assistant's Office Phone (Enter as ###-###-####)</label><br> <input type="text" name="AssistantOfficePhone" size="20"> <p> <label for "AssistantFax">Assistant's Fax (Enter as ###-###-####)</label><br> <input type="text" name="AssistantFax" size="20"> <p> <label for "AssistantNotes">Assistant's Notes</label><br> <textarea name="AssistantNotes" rows=10 cols=20></textarea> <p> <label for "Member">Member</label><br> <select name="Member" id="Member"> <?php foreach($memberarray as $key => $value) { echo "<option value='$key'>$value</option>"; } ?> </select> <p> <label for "MemberType">Member Type</label><br> <select name="MemberType" id="MemberType"> <?php foreach($membertypearray as $key => $value) { echo "<option value='$key'>$value</option>"; } ?> </select> <p> <label for "Contact">Contact</label><br> <select name="Contact" id="Contact"> <?php foreach($contactarray as $key => $value) { echo "<option value='$key'>$value</option>"; } ?> </select> <p> <label for "Categories">Categories</label><br> <select name="Categories" id="Categories"> <?php foreach($categoryarray as $key => $value) { echo "<option value='$key'>$value</option>"; } ?> </select> <p> <label for "Groups">Groups</label><br> <select name="Groups" id="Groups"> <?php foreach($groupsarray as $key => $value) { echo "<option value='$key'>$value</option>"; } ?> </select> <p> <label for "OrganizationDescription">Organization Description</label><br> <textarea name="OrganizationDescription" rows=10 cols=20></textarea> <p> <a href='javascript:void(0);' onmousedown="validateform('makeaccount');" style="padding:3px; background-color: #DF7401; color: #fff; font-family: arial, helvetica, sans-serif; font-size: 12px; font-weight: normal; letter-spacing: .2em;">Submit</a> </fieldset> </form> </body> </html> validation php <?php //include "lib/config.php"; include "lib/arrays.php"; $hasError = false; $errform = ""; $confirmform = ""; $formname = $_GET['formname']; $Salutation = $_GET['Salutation']; if ($Salutation == "" || $Salutation == "null") { $hasError = true; $hasSalError = true; $Salutation = "null"; } else { $confirmform .= "<b>Salutation</b>: $Salutation"; } $FirstName = $_GET['FirstName']; $MiddleName = $_GET['MiddleName']; $LastName = $_GET['LastName']; $SuffixName = $_GET['SuffixName']; $NickName = $_GET['NickName']; $JobTitle = $_GET['JobTitle']; $CompanyName = $_GET['CompanyName']; $Department = $_GET['Department']; $BusinessAddress = $_GET['BusinessAddress']; /*$CoMailAddress2 = $_GET['CoMailAddress2']; $CoMailCity = $_GET['CoMailCity']; $CoMailState = $_GET['CoMailState']; $CoMailZip = $_GET['CoMailZip'];*/ $DirectPhoneNumber = $_GET['DirectPhoneNumber']; $OfficePhoneNumber = $_GET['OfficePhoneNumber']; $FaxNumber = $_GET['FaxNumber']; $MobileNumber = $_GET['MobileNumber']; $EmailAddress = $_GET['EmailAddress']; $Website = $_GET['Website']; $Notes = $_GET['Notes']; $Biography = $_GET['Biography']; $AssistantName = $_GET['AssistantName']; $AssistantOfficePhone = $_GET['AssistantOfficePhone']; $AssistantNotes = $_GET['AssistantNotes']; $Member = $_GET['Member']; $MemberType = $_GET['MemberType']; $Contact = $_GET['Contact']; $Categories = $_GET['Categories']; $Groups = $_GET['Groups']; $OrganizationDescription = $_GET['OrganizationDescription']; $errform = "<form name='makeaccount' action='nasvfform.php' method=POST> <fieldset> <legend> NASVF Sign Up Form Demo </legend>"; if ($hasSalError == true) { $errform .= "<label for 'Salutation'><span style='color: red;'>Salutation</span></label><br>"; } else { $errform .= "<label for 'Salutation'>Salutation</label><br>"; } $errform .= "<select name='Salutation' id='Salutation'>"; foreach($salarray as $key => $value) { if ($key == $Salutation) { $errform .= "<option value='$key' selected>$value</option>"; } else { $errform .= "<option value='$key'>$value</option>"; } } $errform .= "</select> <p>"; if ($FirstName == "") { $hasError = true; $errform .= "<label for 'FirstName'><span style='color: red;'>First Name</span></label><br>"; } else { $errform .= "<label for 'FirstName'>First Name</label><br>"; } $errform .= "<input type='text' name='FirstName' size='20' value='$FirstName'> <p> <label for 'MiddleName'>Middle Name</label><br> <input type='text' name='MiddleName' size='20' value='$MiddleName'> <p>"; if ($LastName == "") { $hasError = true; $errform .= "<label for 'LastName'><span style='color: red;'>Last Name</span></label><br>"; } else { $errform .= "<label for 'LastName'>Last Name</label><br>"; } $errform .= "<input type='text' name='LastName' size='20' value='$LastName'> <p> <label for 'SuffixName'>Suffix</label><br> <input type='text' name='SuffixName' size='20' value='$SuffixName'> <p> <label for 'NickName'>Nick Name</label><br> <input type='text' name='NickName' size='20' value='$NickName'> <p>"; if ($JobTitle == "") { $hasError = true; $errform .= "<label for 'JobTitle'><span style='color: red;'>Job Title</span></label><br>"; } else { $errform .= "<label for 'JobTitle'>Job Title</label><br>"; } $errform .= "<input type='text' name='JobTitle' size='20' value='$JobTitle'> <p>"; if ($CompanyName == "") { $hasError = true; $errform .= "<label for 'CompanyName'><span style='color: red;'>Company Name</span></label><br>"; } else { $errform .= "<label for 'CompanyName'>Company Name</label><br>"; } $errform .= "<input type='text' name='CompanyName' size='20' value='$CompanyName'> <p> <label for 'Department'>Department</label><br> <input type='text' name='Department' size='20'> <p>"; if ($BusinessAddress == "") { $hasError = true; $errform .= "<label for 'BusinessAddress'><span style='color: red;'>Business Address</span></label><br>"; } else { $errform .= "<label for 'BusinessAddress'>Business Address</label><br>"; } $errform .= "<textarea name='BusinessAddress' rows=5 cols=20>$BusinessAddress</textarea> <p>"; if ($DirectPhoneNumber == "") { $hasError = true; $errform .= "<label for 'DirectPhoneNumber'><span style='color:red;'>Direct Phone Number (Enter as ###-###-####)</span></label><br>"; } else { if (strlen(trim($DirectPhoneNumber)) > 0) { if(!ereg('^([1]-)?[0-9]{3}-[0-9]{3}-[0-9]{4}$', $DirectPhoneNumber)){ $hasError = true; $errform .= "<label for 'DirectPhoneNumber'><span style='color:red;'>Direct Phone Number - wrong format</span></label><br>"; } else { $errform .= "<label for 'DirectPhoneNumber'>Direct Phone Number (Enter as ###-###-####)</label><br>"; } } } $errform .= "<input type='text' name='DirectPhoneNumber' size='20' value='$DirectPhoneNumber'> <p>"; if ($OfficePhoneNumber == "") { $hasError = true; $errform .="<label for 'OfficePhoneNumber'><span style='color:red;'>Office Phone Number (Enter as ###-###-####)</span></label><br>"; } else { if (strlen(trim($OfficePhoneNumber)) > 0) { if(!ereg('^([1]-)?[0-9]{3}-[0-9]{3}-[0-9]{4}$', $OfficePhoneNumber)){ $hasError = true; $errform .= "<label for 'OfficePhoneNumber'><span style='color:red;'>Office Phone Number - wrong format</span></label><br>"; } else { $errform .= "<label for 'OfficePhoneNumber'>Direct Phone Number (Enter as ###-###-####)</label><br>"; } } } $errform .="<input type='text' name='OfficePhoneNumber' size='20' value='$OfficePhoneNumber'> <p>"; if ($FaxNumber == "") { $hasError = true; $errform .= "<label for 'FaxNumber'><span style='color: red;'>Office Fax Number (Enter as ###-###-####)</span></label><br>"; } else { if (strlen(trim($FaxNumber)) > 0) { if(!ereg('^([1]-)?[0-9]{3}-[0-9]{3}-[0-9]{4}$', $FaxNumber)){ $hasError = true; $errform .= "<label for 'FaxNumber'><span style='color:red;'>Fax Number - wrong format</span></label><br>"; } else { $errform .= "<label for 'FaxNumber'>Fax Number (Enter as ###-###-####)</label><br>"; } } } $errform .= "<input type='text' name='FaxNumber' size='20' value='$FaxNumber'> <p>"; if ($MobileNumber == "") { $hasError = true; $errform .="<label for 'MobileNumber'><span style='color: red;'>Mobile Number (Enter as ###-###-####)</span></label><br>"; } else { if (strlen(trim($MobileNumber)) > 0) { if(!ereg('^([1]-)?[0-9]{3}-[0-9]{3}-[0-9]{4}$', $MobileNumber)){ $hasError = true; $errform .= "<label for 'MobileNumber'><span style='color:red;'>Mobile Number - wrong format</span></label><br>"; } else { $errform .= "<label for 'MobileNumber'>Mobile Number (Enter as ###-###-####)</label><br>"; } } } $errform .="<input type='text' name='MobileNumber' size='20' value='$MobileNumber'> <p>"; if ($EmailAddress == "") { $hasError = true; $errform .="<label for 'EmailAddress'><span style='color: red;'>Email Address (Enter as [email protected])</span></label><br>"; } else { if (strlen(trim($EmailAddress)) > 0) { if (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $EmailAddress)){ $errform .="<label for 'EmailAddress'><span style='color:red;'>Email Address (Enter as [email protected])</label></span><br>"; } else { $errform .="<label for 'EmailAddress'>Email Address (Enter as [email protected])</label><br>"; } } } $errform .="<input type='text' name='EmailAddress' size='20' value='$EmailAddress'> <p>"; if ($Website == "") { $hasError = true; $errform .="<label for 'Website'><span style='color: red'>Web Site (Must begin with http, https, or ftp)</span></label><br>"; } else { if (preg_match("/^(http(s?):\/\/|ftp:\/\/{1})((\w+\.){1,})\w{2,}$/i", $Website)) { $errform .="<label for 'Website'>Web Site (Must begin with http, https, or ftp)</label><br>"; } else { $errform .="<label for 'Website'><span style='color: red'>Web Site (Must begin with http, https, or ftp)</span></label><br>"; } } $errform .="<input type='text' name='Website' size='20' value='$Website'> <p> <label for \"Notes\">Notes</label><br> <textarea name=\"Notes\" rows=10 cols=20>$Notes</textarea> <p> <label for \"Biography\">Biography</label><br> <textarea name=\"Biography\" rows=15 cols=20>$Biography</textarea> <p> <p> <label for \"AssistantName\">Assitant's Name</label><br> <input type=\"text\" name=\"AssistantName\" size=\"20\" value='$AssistantName'> <p>"; if (strlen(trim($AssistantOfficePhone)) > 0) { if(!ereg('^([1]-)?[0-9]{3}-[0-9]{3}-[0-9]{4}$', $AssistantOfficePhone)){ $hasError = true; $errform .= "<label for 'AssistantOfficePhone'><span style='color:red;'>Assistant Office Phone - wrong format</span></label><br>"; } else { $errform .= "<label for 'AssistantOfficePhone'>Assistant Office Phone (Enter as ###-###-####)</label><br>"; } } else { $errform .= "<label for \"AssistantOfficePhone\">Assistant's Office Phone (Enter as ###-###-####)</label><br>"; } $errform .= "<input type=\"text\" name=\"AssistantOfficePhone\" size=\"20\" value='$AssistantOfficePhone'> <p>"; if (strlen(trim($AssistantFax)) > 0) { if(!ereg('^([1]-)?[0-9]{3}-[0-9]{3}-[0-9]{4}$', $AssistantFax)){ $hasError = true; $errform .= "<label for 'AssistantFax'><span style='color:red;'>Assistant Fax - wrong format</span></label><br>"; } else { $errform .= "<label for 'AssistantFax'>Assistant Fax (Enter as ###-###-####)</label><br>"; } } else { $errform .= "<label for \"AssistantFax\">Assistant's Fax (Enter as ###-###-####)</label><br>"; } $errform .= "<input type=\"text\" name=\"AssistantFax\" size=\"20\" value='$AssistantFax'> <p> <label for \"AssistantNotes\">Assistant's Notes</label><br> <textarea name=\"AssistantNotes\" rows=10 cols=20>$AssistantNotes</textarea> <p>"; if ($Member == "null") { $hasError = true; $errform .= "<label for \"Member\"><span style='color: red;'>Member</span></label><br>"; } else { $errform .= "<label for \"Member\">Member</label><br>"; } $errform .="<select name=\"Member\" id=\"Member\">"; foreach($memberarray as $key => $value) { if ($key == $Member) { $errform .= "<option value='$key' selected>$value</option>"; } else { $errform .= "<option value='$key'>$value</option>"; } } $errform .="</select> <p>"; if ($MemberType == "null") { $hasError = true; $errform .= "<label for \"MemberType\"><span style='color: red;'>Member Type</span></label><br>"; } else { $errform .= "<label for \"MemberType\">Member Type</label><br>"; } $errform .="<select name=\"MemberType\" id=\"MemberType\">"; foreach($membertypearray as $key => $value) { if ($key == $MemberType) { $errform .= "<option value='$key' selected>$value</option>"; } else { $errform .= "<option value='$key'>$value</option>"; } } $errform .="</select> <p>"; if ($Contact == "null") { $hasError = true; $errform .= "<label for \"Contact\"><span style='color: red;'>Contact</span></label><br>"; } else { $errform .= "<label for \"Contact\">Contact</label><br>"; } $errform .="<select name=\"Contact\" id=\"Contact\">"; foreach($contactarray as $key => $value) { if ($key == $Contact) { $errform .= "<option value='$key' selected>$value</option>"; } else { $errform .= "<option value='$key'>$value</option>"; } } $errform .="</select> <p>"; if ($Categories == "null") { $hasError = true; $errform .= "<label for \"Categories\"><span style='color: red;'>Categories</span></label><br>"; } else { $errform .= "<label for \"Categories\">Categories</label><br>"; } $errform .="<select name=\"Categories\" id=\"Categories\">"; foreach($categoryarray as $key => $value) { if ($key == $Categories) { $errform .= "<option value='$key' selected>$value</option>"; } else { $errform .= "<option value='$key'>$value</option>"; } } $errform .="</select> <p>"; if ($Groups == "null") { $hasError = true; $errform .= "<label for \"Groups\"><span style='color: red;'>Groups</span></label><br>"; } else { $errform .= "<label for \"Groups\">Groups</label><br>"; } $errform .="<select name=\"Groups\" id=\"Groups\">"; foreach($groupsarray as $key => $value) { if ($key == $Groups) { $errform .= "<option value='$key' selected>$value</option>"; } else { $errform .= "<option value='$key'>$value</option>"; } } $errform .="</select> <p>"; if ($OrganizationDescription == "") { $hasError = true; $errform .= "<label for \"OrganizationDescription\"><span style='color: red;'>Organization Description</span></label><br>"; } else { $errform .= "<label for \"OrganizationDescription\">Organization Description</label><br>"; } $errform .="<textarea name=\"OrganizationDescription\" rows=10 cols=20>$OrganizationDescription</textarea> <p>"; $errform .="<a href='javascript:void(0);' onmousedown=\"validateform('makeaccount');\" style='padding:3px; background-color: #DF7401; color: #fff; font-family: arial, helvetica, sans-serif; font-size: 12px; font-weight: normal; letter-spacing: .2em;'>Submit</a> </fieldset> </form>"; if ($hasError == true) { echo "Please correct the entries that are noted in red.<p>" . $errform; } else { echo "Please confirm the following information is correct:<p>" . $errform; } ?> arrays include <?php $state_array = array('AL'=>"Alabama", 'AK'=>"Alaska", 'AZ'=>"Arizona", 'AR'=>"Arkansas", 'CA'=>"California", 'CO'=>"Colorado", 'CT'=>"Connecticut", 'DE'=>"Delaware", 'DC'=>"District Of Columbia", 'FL'=>"Florida", 'GA'=>"Georgia", 'HI'=>"Hawaii", 'ID'=>"Idaho", 'IL'=>"Illinois", 'IN'=>"Indiana", 'IA'=>"Iowa", 'KS'=>"Kansas", 'KY'=>"Kentucky", 'LA'=>"Louisiana", 'ME'=>"Maine", 'MD'=>"Maryland", 'MA'=>"Massachusetts", 'MI'=>"Michigan", 'MN'=>"Minnesota", 'MS'=>"Mississippi", 'MO'=>"Missouri", 'MT'=>"Montana", 'NE'=>"Nebraska", 'NV'=>"Nevada", 'NH'=>"New Hampshire", 'NJ'=>"New Jersey", 'NM'=>"New Mexico", 'NY'=>"New York", 'NC'=>"North Carolina", 'ND'=>"North Dakota", 'OH'=>"Ohio", 'OK'=>"Oklahoma", 'OR'=>"Oregon", 'PA'=>"Pennsylvania", 'RI'=>"Rhode Island", 'SC'=>"South Carolina", 'SD'=>"South Dakota", 'TN'=>"Tennessee", 'TX'=>"Texas", 'UT'=>"Utah", 'VT'=>"Vermont", 'VA'=>"Virginia", 'WA'=>"Washington", 'WV'=>"West Virginia", 'WI'=>"Wisconsin", 'WY'=>"Wyoming"); $country_array = array('AF'=>'AFGHANISTAN', 'AL'=>'ALBANIA', 'DZ'=>'ALGERIA', 'AS'=>'AMERICAN SAMOA', 'AD'=>'ANDORRA', 'AO'=>'ANGOLA', 'AI'=>'ANGUILLA', 'AQ'=>'ANTARCTICA', 'AG'=>'ANTIGUA AND BARBUDA', 'AR'=>'ARGENTINA', 'AM'=>'ARMENIA', 'AW'=>'ARUBA', 'AU'=>'AUSTRALIA', 'AT'=>'AUSTRIA', 'AZ'=>'AZERBAIJAN', 'BS'=>'BAHAMAS', 'BH'=>'BAHRAIN', 'BD'=>'BANGLADESH', 'BB'=>'BARBADOS', 'BY'=>'BELARUS', 'BE'=>'BELGIUM', 'BZ'=>'BELIZE', 'BJ'=>'BENIN', 'BM'=>'BERMUDA', 'BT'=>'BHUTAN', 'BO'=>'BOLIVIA', 'BA'=>'BOSNIA AND HERZEGOVINA', 'BW'=>'BOTSWANA', 'BV'=>'BOUVET ISLAND', 'BR'=>'BRAZIL', 'IO'=>'BRITISH INDIAN OCEAN TERRITORY', 'BN'=>'BRUNEI DARUSSALAM', 'BG'=>'BULGARIA', 'BF'=>'BURKINA FASO', 'BI'=>'BURUNDI', 'KH'=>'CAMBODIA', 'CM'=>'CAMEROON', 'CA'=>'CANADA', 'CV'=>'CAPE VERDE', 'KY'=>'CAYMAN ISLANDS', 'CF'=>'CENTRAL AFRICAN REPUBLIC', 'TD'=>'CHAD', 'CL'=>'CHILE', 'CN'=>'CHINA', 'CX'=>'CHRISTMAS ISLAND', 'CC'=>'COCOS (KEELING) ISLANDS', 'CO'=>'COLOMBIA', 'KM'=>'COMOROS', 'CG'=>'CONGO', 'CD'=>'CONGO, THE DEMOCRATIC REPUBLIC OF THE', 'CK'=>'COOK ISLANDS', 'CR'=>'COSTA RICA', 'CI'=>'COTE D IVOIRE', 'HR'=>'CROATIA', 'CU'=>'CUBA', 'CY'=>'CYPRUS', 'CZ'=>'CZECH REPUBLIC', 'DK'=>'DENMARK', 'DJ'=>'DJIBOUTI', 'DM'=>'DOMINICA', 'DO'=>'DOMINICAN REPUBLIC', 'TP'=>'EAST TIMOR', 'EC'=>'ECUADOR', 'EG'=>'EGYPT', 'SV'=>'EL SALVADOR', 'GQ'=>'EQUATORIAL GUINEA', 'ER'=>'ERITREA', 'EE'=>'ESTONIA', 'ET'=>'ETHIOPIA', 'FK'=>'FALKLAND ISLANDS (MALVINAS)', 'FO'=>'FAROE ISLANDS', 'FJ'=>'FIJI', 'FI'=>'FINLAND', 'FR'=>'FRANCE', 'GF'=>'FRENCH GUIANA', 'PF'=>'FRENCH POLYNESIA', 'TF'=>'FRENCH SOUTHERN TERRITORIES', 'GA'=>'GABON', 'GM'=>'GAMBIA', 'GE'=>'GEORGIA', 'DE'=>'GERMANY', 'GH'=>'GHANA', 'GI'=>'GIBRALTAR', 'GR'=>'GREECE', 'GL'=>'GREENLAND', 'GD'=>'GRENADA', 'GP'=>'GUADELOUPE', 'GU'=>'GUAM', 'GT'=>'GUATEMALA', 'GN'=>'GUINEA', 'GW'=>'GUINEA-BISSAU', 'GY'=>'GUYANA', 'HT'=>'HAITI', 'HM'=>'HEARD ISLAND AND MCDONALD ISLANDS', 'VA'=>'HOLY SEE (VATICAN CITY STATE)', 'HN'=>'HONDURAS', 'HK'=>'HONG KONG', 'HU'=>'HUNGARY', 'IS'=>'ICELAND', 'IN'=>'INDIA', 'ID'=>'INDONESIA', 'IR'=>'IRAN, ISLAMIC REPUBLIC OF', 'IQ'=>'IRAQ', 'IE'=>'IRELAND', 'IL'=>'ISRAEL', 'IT'=>'ITALY', 'JM'=>'JAMAICA', 'JP'=>'JAPAN', 'JO'=>'JORDAN', 'KZ'=>'KAZAKSTAN', 'KE'=>'KENYA', 'KI'=>'KIRIBATI', 'KP'=>'KOREA DEMOCRATIC PEOPLES REPUBLIC OF', 'KR'=>'KOREA REPUBLIC OF', 'KW'=>'KUWAIT', 'KG'=>'KYRGYZSTAN', 'LA'=>'LAO PEOPLES DEMOCRATIC REPUBLIC', 'LV'=>'LATVIA', 'LB'=>'LEBANON', 'LS'=>'LESOTHO', 'LR'=>'LIBERIA', 'LY'=>'LIBYAN ARAB JAMAHIRIYA', 'LI'=>'LIECHTENSTEIN', 'LT'=>'LITHUANIA', 'LU'=>'LUXEMBOURG', 'MO'=>'MACAU', 'MK'=>'MACEDONIA, THE FORMER YUGOSLAV REPUBLIC OF', 'MG'=>'MADAGASCAR', 'MW'=>'MALAWI', 'MY'=>'MALAYSIA', 'MV'=>'MALDIVES', 'ML'=>'MALI', 'MT'=>'MALTA', 'MH'=>'MARSHALL ISLANDS', 'MQ'=>'MARTINIQUE', 'MR'=>'MAURITANIA', 'MU'=>'MAURITIUS', 'YT'=>'MAYOTTE', 'MX'=>'MEXICO', 'FM'=>'MICRONESIA, FEDERATED STATES OF', 'MD'=>'MOLDOVA, REPUBLIC OF', 'MC'=>'MONACO', 'MN'=>'MONGOLIA', 'MS'=>'MONTSERRAT', 'MA'=>'MOROCCO', 'MZ'=>'MOZAMBIQUE', 'MM'=>'MYANMAR', 'NA'=>'NAMIBIA', 'NR'=>'NAURU', 'NP'=>'NEPAL', 'NL'=>'NETHERLANDS', 'AN'=>'NETHERLANDS ANTILLES', 'NC'=>'NEW CALEDONIA', 'NZ'=>'NEW ZEALAND', 'NI'=>'NICARAGUA', 'NE'=>'NIGER', 'NG'=>'NIGERIA', 'NU'=>'NIUE', 'NF'=>'NORFOLK ISLAND', 'MP'=>'NORTHERN MARIANA ISLANDS', 'NO'=>'NORWAY', 'OM'=>'OMAN', 'PK'=>'PAKISTAN', 'PW'=>'PALAU', 'PS'=>'PALESTINIAN TERRITORY, OCCUPIED', 'PA'=>'PANAMA', 'PG'=>'PAPUA NEW GUINEA', 'PY'=>'PARAGUAY', 'PE'=>'PERU', 'PH'=>'PHILIPPINES', 'PN'=>'PITCAIRN', 'PL'=>'POLAND', 'PT'=>'PORTUGAL', 'PR'=>'PUERTO RICO', 'QA'=>'QATAR', 'RE'=>'REUNION', 'RO'=>'ROMANIA', 'RU'=>'RUSSIAN FEDERATION', 'RW'=>'RWANDA', 'SH'=>'SAINT HELENA', 'KN'=>'SAINT KITTS AND NEVIS', 'LC'=>'SAINT LUCIA', 'PM'=>'SAINT PIERRE AND MIQUELON', 'VC'=>'SAINT VINCENT AND THE GRENADINES', 'WS'=>'SAMOA', 'SM'=>'SAN MARINO', 'ST'=>'SAO TOME AND PRINCIPE', 'SA'=>'SAUDI ARABIA', 'SN'=>'SENEGAL', 'SC'=>'SEYCHELLES', 'SL'=>'SIERRA LEONE', 'SG'=>'SINGAPORE', 'SK'=>'SLOVAKIA', 'SI'=>'SLOVENIA', 'SB'=>'SOLOMON ISLANDS', 'SO'=>'SOMALIA', 'ZA'=>'SOUTH AFRICA', 'GS'=>'SOUTH GEORGIA AND THE SOUTH SANDWICH ISLANDS', 'ES'=>'SPAIN', 'LK'=>'SRI LANKA', 'SD'=>'SUDAN', 'SR'=>'SURINAME', 'SJ'=>'SVALBARD AND JAN MAYEN', 'SZ'=>'SWAZILAND', 'SE'=>'SWEDEN', 'CH'=>'SWITZERLAND', 'SY'=>'SYRIAN ARAB REPUBLIC', 'TW'=>'TAIWAN, PROVINCE OF CHINA', 'TJ'=>'TAJIKISTAN', 'TZ'=>'TANZANIA, UNITED REPUBLIC OF', 'TH'=>'THAILAND', 'TG'=>'TOGO', 'TK'=>'TOKELAU', 'TO'=>'TONGA', 'TT'=>'TRINIDAD AND TOBAGO', 'TN'=>'TUNISIA', 'TR'=>'TURKEY', 'TM'=>'TURKMENISTAN', 'TC'=>'TURKS AND CAICOS ISLANDS', 'TV'=>'TUVALU', 'UG'=>'UGANDA', 'UA'=>'UKRAINE', 'AE'=>'UNITED ARAB EMIRATES', 'GB'=>'UNITED KINGDOM', 'US'=>'UNITED STATES', 'UM'=>'UNITED STATES MINOR OUTLYING ISLANDS', 'UY'=>'URUGUAY', 'UZ'=>'UZBEKISTAN', 'VU'=>'VANUATU', 'VE'=>'VENEZUELA', 'VN'=>'VIET NAM', 'VG'=>'VIRGIN ISLANDS, BRITISH', 'VI'=>'VIRGIN ISLANDS, U.S.', 'WF'=>'WALLIS AND FUTUNA', 'EH'=>'WESTERN SAHARA', 'YE'=>'YEMEN', 'YU'=>'YUGOSLAVIA', 'ZM'=>'ZAMBIA', 'ZW'=>'ZIMBABWE', ); $salarray = array("null" => "Select One", "Mr." => "Mr.", "Mrs." => "Mrs.", "Ms." => "Ms.", "Dr." => "Dr."); $memberarray = array("null" => "Select One", "Yes" => "Yes", "Prospect" => "Prospect", "Lapsed" => "Lapsed", "Declined" => "Declined", "No" => "No"); $membertypearray = array("null" => "Select One", "Angel" => "Angel", "Seed Fund" => "Seed Fund", "Venture Fund" => "Venture Fund", "Public Agency" => "Public Agency", "Incubator/Accelerator" => "Incubator/Accelerator", "Law Firm" => "Law Firm", "Accountant" => "Accountant", "Consultant" => "Consultant", "Comp" => "Comp", "Affiliate" => "Affiliate", "Venture" => "Venture", "Sustaining" => "Sustaining"); $membergroupsarray = array("null" => "Select One", "NetNews" => "NetNews", "Conference Blast Emails" => "Conference Blast Emails", "NASVF Notifications" => "NASVF Notifications"); $contactarray = array("null" => "Select One", "Lead" => "Lead", "Alternate" => "Alternate"); $categoryarray = array ("null" => "Select One", "Accountant" => "Accountant", "Angel" => "Angel", "Attorney" => "Attorney", "Board Member" => "Board Member", "Conf 01:participant" => "Conf 01:participant", "Conf 02:participant" => "Conf 02:participant", "Conf 03:participant" => "Conf 03:participant", "Conf 04:participant" => "Conf 04:participant", "Conf 05:participant" => "Conf 05:participant", "Conf 06:participant" => "Conf 06:participant", "Conf 07:participant" => "Conf 07:participant", "Conf 08:participant" => "Conf 08:participant", "Conf 05:speaker" => "Conf 05:speaker", "Conf 06:speaker" => "Conf 06:speaker", "Conf 07:speaker" => "Conf 07:speaker", "Conf 08:speaker" => "Conf 08:speaker", "Conf 06:sponsor" => "Conf 06:sponsor", "Conf 07:sponsor" => "Conf 07:sponsor", "Conf 08:sponsor" => "Conf 08:sponsor", "Conf 08:sponsor prospect" => "Conf 08:sponsor prospect", "EDC" => "EDC", "Incubator" => "Incubator", "Media" => "Media", "Reporter" => "Reporter", "Research Park" => "Research Park", "State DOC" => "State DOC", "Tech Transfer" => "Tech Transfer", "University" => "University"); $groupsarray = array("null" => "Select One", "NetNews" => "NetNews", "Conference Blast Emails" => "Conference Blast Emails", "NASVF Notifications" => "NASVF Notifications"); ?> Link to comment https://forums.phpfreaks.com/topic/137623-form-validation-using-ajax-and-php/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.