Jump to content

Recommended Posts

I am quite inexperienced when it comes to coding and I obtained a template for an online form submission that I butchered to meet my needs. Our clients are attempting to send the form, and there are times that it transmits correctly, and times that it won't. There is verification code to try and eliminate bots from filing and submitting bogus forms. Can anyone spend the time to review my code and attempt to tell you where my issue may lie? You may view my form at http://www.damageana.com/new_assignment.php

<?php

    session_start();
    
    function getRealIp() {
       if (!empty($_SERVER['HTTP_CLIENT_IP'])) {  //check ip from share internet
         $ip=$_SERVER['HTTP_CLIENT_IP'];
       } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {  //to check ip is pass from proxy
         $ip=$_SERVER['HTTP_X_FORWARDED_FOR'];
       } else {
         $ip=$_SERVER['REMOTE_ADDR'];
       }
       return $ip;
    }

    function writeLog($where) {
    
    	$ip = getRealIp(); // Get the IP from superglobal
    	$host = gethostbyaddr($ip);    // Try to locate the host of the attack
    	$date = date("d M Y");
    	
    	// create a logging message with php heredoc syntax
    	$logging = <<<LOG
    		\n
    		<< Start of Message >>
    		There was a hacking attempt on your form. \n 
    		Date of Attack: {$date}
    		IP-Adress: {$ip} \n
    		Host of Attacker: {$host}
    		Point of Attack: {$where}
    		<< End of Message >>
LOG;
// Awkward but LOG must be flush left
    
            // open log file
    		if($handle = fopen('hacklog.log', 'a')) {
    		
    			fputs($handle, $logging);  // write the Data to file
    			fclose($handle);           // close the file
    			
    		} else {  // if first method is not working, for example because of wrong file permissions, email the data
    		
    			$to = 'aserio@damageana.com';  
            	$subject = 'HACK ATTEMPT';
            	$header = 'From: aserio@damageana.com';
            	if (mail($to, $subject, $logging, $header)) {
            		echo "Sent notice to admin.";
            	}
    
    		}
    }

    function verifyFormToken($form) {
        
        // check if a session is started and a token is transmitted, if not return an error
    	if(!isset($_SESSION[$form.'_token'])) { 
    		return false;
        }
    	
    	// check if the form is sent with token in it
    	if(!isset($_POST['token'])) {
    		return false;
        }
    	
    	// compare the tokens against each other if they are still the same
    	if ($_SESSION[$form.'_token'] !== $_POST['token']) {
    		return false;
        }
    	
    	return true;
    }
    
    function generateFormToken($form) {
    
        // generate a token from an unique value, took from microtime, you can also use salt-values, other crypting methods...
    	$token = md5(uniqid(microtime(), true));  
    	
    	// Write the generated token to the session variable to check it against the hidden field when the form is sent
    	$_SESSION[$form.'_token'] = $token; 
    	
    	return $token;
    }
    
    // VERIFY LEGITIMACY OF TOKEN
    if (verifyFormToken('form1')) {
    
        // CHECK TO SEE IF THIS IS A MAIL POST
        if (isset($_POST['req-name'])) {
        
            // Building a whitelist array with keys which will send through the form, no others would be accepted later on
            $whitelist = array('token','req-company','req-email','req-name','req-phone','ext','fax','assign_type','loss_type','req-claim','policy','ded','dol','Clmt-Own','insd','insd_add','insd_city','insd_st','insd-zip','insd-home','insd-work','insd-cell','insd-other','clmt','clmt_add','clmt_city','clmt_st','clmt-zip','clmt-home','clmt-work','clmt-cell','clmt-other','VIN','veh-year','veh-make','veh-model','veh-model','veh-color','lic_pl','location','loc-name','loc-add','loc-city','loc-st','loc-zip','loc-con','loc-phone','desc-loss','desc-dmg','spec-inst','save-company','save-email','save-name','save-phone');
            
            // Building an array with the $_POST-superglobal 
            foreach ($_POST as $key=>$item) {
                    
                    // Check if the value $key (fieldname from $_POST) can be found in the whitelisting array, if not, die with a short message to the hacker
            		if (!in_array($key, $whitelist)) {
            			
            			writeLog('Unknown form fields');
            			die("Hack-Attempt detected. Please use only the fields in the form");
            			
            		}
            }
            
            // SAVE INFO AS COOKIE, if user wants name and email saved
            
            $saveCompany = $_POST['save-company'];
            if ($saveCompany == 'on') {
                setcookie("NA-Company", $_POST['req-company'], time()+60*60*24*365);
                }
                
            $saveName = $_POST['save-name'];
            if ($saveName == 'on') {
                setcookie("NA-Name", $_POST['req-name'], time()+60*60*24*365);
                }
                
            $saveEmail = $_POST['save-email'];
            if ($saveEmail =='on') {
                setcookie("NA-Email", $_POST['req-email'], time()+60*60*24*365);
            }
            
            $savePhone = $_POST['save-phone'];
            if ($savePhone =='on') {
	            setcookie("NA-Phone", $_POST['req-phone'], time()+60*60*24*365);
            }
            
            
            
            // PREPARE THE BODY OF THE MESSAGE

			$message = '<html><body>';
			$message .= '<img src="http://www.damageana.com/images/DANA_NA_header.png" alt="Assignment Request" />';
			$message .= '<table rules="all" style="border-color: #666;" cellpadding="10">';
			$message .= "<tr style='background: #eee;'><td><strong>Company:</strong> </td><td>" . strip_tags($_POST['req-company']) . "</td></tr>";
			$message .= "<tr><td><strong>Adjuster:</strong> </td><td>" . strip_tags($_POST['req-name']) . "</td></tr>";
			$message .= "<tr><td><strong>Email:</strong> </td><td>" . strip_tags($_POST['req-email']) . "</td></tr>";
			$message .= "<tr><td><strong>Phone:</strong> </td><td>" . strip_tags($_POST['req-phone']) . "</td></tr>";
			if($_POST['ext'] !='') {$message .= "<tr><td><strong>Extension:</strong> </td><td>" . strip_tags($_POST['ext']) . "</td></tr>";}
			if($_POST['fax'] !='') {$message .= "<tr><td><strong>Fax:</strong> </td><td>" . strip_tags($_POST['fax']) . "</td></tr>";}
			$message .= "<tr><td><strong>Assignment Type:</strong> </td><td>" . strip_tags($_POST['assign_type']) . "</td></tr>";
			if($_POST['loss_type'] !='') {$message .= "<tr><td><strong>Type of Loss:</strong> </td><td>" . strip_tags($_POST['loss_type']) . "</td></tr>";}
			$message .= "<tr><td><strong>Claim #:</strong> </td><td>" . strip_tags($_POST['req-claim']) . "</td></tr>";
			if($_POST['policy'] !='') {$message .= "<tr><td><strong>Policy #:</strong> </td><td>" . strip_tags($_POST['policy']) . "</td></tr>";}
			if($_POST['ded'] !='') {$message .= "<tr><td><strong>Deductible:</strong> </td><td> $" . strip_tags($_POST['ded']) . "</td></tr>";}
			if($_POST['dol'] !='') {$message .= "<tr><td><strong>Date of Loss:</strong> </td><td>" . strip_tags($_POST['dol']) . "</td></tr>";}
			if($_POST['insd'] !='') {$message .= "<tr><td><strong>Insured:</strong> </td><td>" . strip_tags($_POST['insd']) . "</td></tr>";}
			if($_POST['insd_add'] !='') {$message .= "<tr><td><strong>Insured's Address:</strong> </td><td>" . strip_tags($_POST['insd_add']) . "</td></tr>";}
			if($_POST['insd_city'] !='') {$message .= "<tr><td><strong>Insured's City:</strong> </td><td>" . strip_tags($_POST['insd_city']) . "</td></tr>";}
			if($_POST['insd_st'] !='') {$message .= "<tr><td><strong>Insured's State:</strong> </td><td>" . strip_tags($_POST['insd_st']) . "</td></tr>";}
			if($_POST['insd-zip'] !='') {$message .= "<tr><td><strong>Insured's Zip:</strong> </td><td>" . strip_tags($_POST['insd-zip']) . "</td></tr>";}
			if($_POST['insd-home'] !='') {$message .= "<tr><td><strong>Insured's Home Phone:</strong> </td><td>" . strip_tags($_POST['insd-home']) . "</td></tr>";}
			if($_POST['insd-work'] !='') {$message .= "<tr><td><strong>Insured's Work Phone:</strong> </td><td>" . strip_tags($_POST['insd-work']) . "</td></tr>";}
			if($_POST['insd-cell'] !='') {$message .= "<tr><td><strong>Insured's Mobile Phone:</strong> </td><td>" . strip_tags($_POST['insd-cell']) . "</td></tr>";}
			if($_POST['insd-other'] !='') {$message .= "<tr><td><strong>Insured's Other Phone:</strong> </td><td>" . strip_tags($_POST['insd-other']) . "</td></tr>";}
			if($_POST['clmt'] !='') {$message .= "<tr><td><strong>Claimant:</strong> </td><td>" . strip_tags($_POST['clmt']) . "</td></tr>";
			$message .= "<tr><td><strong>Claimant's Address:</strong> </td><td>" . strip_tags($_POST['clmt_add']) . "</td></tr>";
			$message .= "<tr><td><strong>Claimant's City:</strong> </td><td>" . strip_tags($_POST['clmt_city']) . "</td></tr>";
			$message .= "<tr><td><strong>Claimant's State:</strong> </td><td>" . strip_tags($_POST['clmt_st']) . "</td></tr>";
			$message .= "<tr><td><strong>Claimant's Zip:</strong> </td><td>" . strip_tags($_POST['clmt-zip']) . "</td></tr>";
			$message .= "<tr><td><strong>Claimant's Home Phone:</strong> </td><td>" . strip_tags($_POST['clmt-home']) . "</td></tr>";
			$message .= "<tr><td><strong>Claimant's Work Phone:</strong> </td><td>" . strip_tags($_POST['clmt-work']) . "</td></tr>";
			$message .= "<tr><td><strong>Claimant's Mobile Phone:</strong> </td><td>" . strip_tags($_POST['clmt-cell']) . "</td></tr>";
			$message .= "<tr><td><strong>Claimant's Other Phone:</strong> </td><td>" . strip_tags($_POST['clmt-other']) . "</td></tr>";}
			if($_POST['VIN'] !='') {$message .= "<tr><td><strong>VIN:</strong> </td><td>" . strip_tags($_POST['VIN']) . "</td></tr>";}
			if($_POST['veh-year'] !='') {$message .= "<tr><td><strong>Year:</strong> </td><td>" . strip_tags($_POST['veh-year']) . "</td></tr>";}
			if($_POST['veh-make'] !='') {$message .= "<tr><td><strong>Make:</strong> </td><td>" . strip_tags($_POST['veh-make']) . "</td></tr>";}
			if($_POST['veh-model'] !='') {$message .= "<tr><td><strong>Model:</strong> </td><td>" . strip_tags($_POST['veh-model']) . "</td></tr>";}
			if($_POST['veh-color'] !='') {$message .= "<tr><td><strong>Color:</strong> </td><td>" . strip_tags($_POST['veh-color']) . "</td></tr>";}
			if($_POST['lic_pl'] !='') {$message .= "<tr><td><strong>License Plate:</strong> </td><td>" . strip_tags($_POST['lic_pl']) . "</td></tr>";}
			$message .= "<tr><td><strong>Unit Location:</strong> </td><td>" . strip_tags($_POST['location']) . "</td></tr>";
			if($_POST['location'] =='At Another Location') {$message .= "<tr><td><strong>Location Name:</strong> </td><td>" . strip_tags($_POST['loc-name']) . "</td></tr>";}
			if($_POST['location'] =='At Another Location') {$message .= "<tr><td><strong>Location Address:</strong> </td><td>" . strip_tags($_POST['loc-add']) . "</td></tr>";}
			if($_POST['location'] =='At Another Location') {$message .= "<tr><td><strong>Location City:</strong> </td><td>" . strip_tags($_POST['loc-city']) . "</td></tr>";}
			if($_POST['location'] =='At Another Location') {$message .= "<tr><td><strong>Location State:</strong> </td><td>" . strip_tags($_POST['loc-st']) . "</td></tr>";}
			if($_POST['location'] =='At Another Location') {$message .= "<tr><td><strong>Location Zip:</strong> </td><td>" . strip_tags($_POST['loc-zip']) . "</td></tr>";}
			if($_POST['location'] =='At Another Location') {$message .= "<tr><td><strong>Location Contact:</strong> </td><td>" . strip_tags($_POST['loc-con']) . "</td></tr>";}
			if($_POST['location'] =='At Another Location') {$message .= "<tr><td><strong>Location Phone:</strong> </td><td>" . strip_tags($_POST['loc-phone']) . "</td></tr>";}
			if($_POST['desc-loss'] !='') {$message .= "<tr><td><strong>Description of Loss:</strong> </td><td>" . htmlentities($_POST['desc-loss']) . "</td></tr>";}
			if($_POST['desc-dmg'] !='') {$message .= "<tr><td><strong>Description of Damage:</strong> </td><td>" . htmlentities($_POST['desc-dmg']) . "</td></tr>";}
			if($_POST['spec-inst'] !='') {$message .= "<tr><td><strong>Special Instructions:</strong> </td><td>" . htmlentities($_POST['spec-inst']) . "</td></tr>";}
			$message .= "</table>";
			$message .= "</body></html>";
			
			
			
			
			//  MAKE SURE THE "FROM" EMAIL ADDRESS DOESN'T HAVE ANY NASTY STUFF IN IT
			
			$pattern = "/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/i"; 
            if (preg_match($pattern, trim(strip_tags($_POST['req-email'])))) { 
                $cleanedFrom = trim(strip_tags($_POST['req-email'])); 
            } else { 
                return "The email address you entered was invalid. Please try again!"; 
            } 
			
			
            
            
            //   CHANGE THE BELOW VARIABLES TO YOUR NEEDS
             
			$to = 'office@damageana.com';
			
			$subject = 'New Assignment Request';
			
			$headers = "From: " . $cleanedFrom . "\r\n";
			$headers .= "Reply-To: ". strip_tags($_POST['req-email']) . "\r\n";
			$headers .= "MIME-Version: 1.0\r\n";
			$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";

            if (mail($to, $subject, $message, $headers)) {
              echo 'Your message has been sent.';
            } else {
              echo 'There was a problem sending the email.';
            }
            
            // DON'T BOTHER CONTINUING TO THE HTML...
            die();
        
        }
    } else {
    
   		if (!isset($_SESSION[$form.'_token'])) {
   		
   		} else {
   			echo "Hack-Attempt detected. Got ya!.";
   			writeLog('Formtoken');
   	    }
   
   	}

?>

<!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" xml:lang="fr" lang="fr">

<head>

	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

	<title>New Assignment Request Form</title>

	<link rel="stylesheet" href="css/jqtransform.css" type="text/css" media="all" />
	<link rel="stylesheet" href="css/style.css" type="text/css" media="all" />
	
	<script src="http://www.google.com/jsapi" type="text/javascript"></script>
    <script type="text/javascript">
        google.load("jquery", "1.3.2");
    </script>
    
	<script type="text/javascript" src="js/jquery.jqtransform.js"></script>
	<script type="text/javascript" src="js/jquery.validate.js"></script>
	<script type="text/javascript" src="js/jquery.form.js"></script>
	<script type="text/javascript" src="js/websitechange.js"></script>
	
</head>

<?php
   // generate a new token for the $_SESSION superglobal and put them in a hidden field
	$newToken = generateFormToken('form1');   
?>

<body>
    <div id="page-wrap">
    
    <img src="http://www.damageana.com/images/logo.png"  alt="DANA_logo" width="750" height="70" />

    <h1>New Assignment Request Form</h1>

	<form action="new_assignment.php" method="post" id="change-form">
	
	<h4>IMPORTANT - PLEASE READ.</h4>
	<h3>
    -Please provide us with as much information as possible to aide us in setting up a new appraisal for you. 
    <br>
    <br>
    -Please be sure to provide as least one good contact number for the vehicle owner.
    <br>
    <br>
    -Once submitted, you will receive an acknowledgement in your e-mail with information regarding the appraisal for your claim.
    <br>
    <br>
    -If submitted before 3 PM, and no acknowledgement is received by 5 PM, please call our office to confirm we received the request.</h3> 
	
	    <input type="hidden" name="token" value="<?php echo $newToken; ?>">
	
		<div class="rowElem">
            <label for="req-company">Company*:</label>
            <input type="text" id="req-company" name="req-company" class="required" minlength="2" value="<?php echo $_COOKIE["NA-Company"]; ?>" />
        </div>
        
         <div class="rowElem">
            <label for="req-name">Adjuster*:</label>
            <input type="text" id="req-name" name="req-name" class="required" minlength="2" value="<?php echo $_COOKIE["NA-Name"]; ?>" />
        </div>
        
        <div class="rowElem">
            <label for="req-email">E-mail*:</label>
            <input type="text" name="req-email" class="required email" value="<?php echo $_COOKIE["NA-Email"]; ?>" />
        </div>
        
        <div class="rowElem">
        	<label for="req-phone">Phone*:</label>
        	<input type"text" id="req-phone" name="req-phone" class="required" maxlength="12" value="<?php echo $_COOKIE["NA-Phone"]; ?>" />
        </div>
        
        <div class="rowElem">
        	<label for="ext">Extension:</label>
        	<input type="text" id="ext" />
        </div>
        
        <div class="rowElem">
        	<label for="fax">Fax:</label>
        	<input type="text" id"fax" />
        </div>
      
        <h2>Claim Info</h2>
        
        <div class="rowElemSelect">
			<label for="assign_type">Assignment Type*:</label>
			<select name="assign_type" class="required">
				<option value="Automobile">Automobile</option>
				<option value="Recreational">Recreational</option>
				<option value="Heavy Equipment">Heavy Equipment</option>
				<option value="Property">Minor Property</option>
				<option value="Estimate Audit">Estimate Audit</option>
				<option value="Scene Investigation">Scene Investigation</option>
				<option value="Arbitration">Arbitration</option>
				<option value="DRP Inspection">DRP Quality Control Inspection</option>
				<option value="Photos Only">Photos Only</option>
			</select>
		</div>
		
		<br>
		
		<div class"rowElemSelect">
			<label for="loss_type">Type of Loss:</label>
			<select name="loss_type" id="loss_type">
				<option value="Collision">Collision</option>
				<option value="Comprehensive">Comprehensive</option>
				<option value="Other">Other</option>
			</select>
		</div>
		
		<div class="rowElem">
			<label for="req-claim">Claim #*:</label>
			<input type="text" id="req-claim" name="req-claim" class="required">
		</div>
        
        <div class="rowElem">
        	<label for"policy">Policy #:</label>
        	<input type="text" id="policy" name="policy">
        </div>
        
        <div class="rowElem">
        	<label for="ded">Deductible:</label>
        	<input type="text" id="ded" name="ded">
        </div>
        
        <div class="rowElem">
        	<label for="dol">Date of Loss:</label>
        	<input type="date" id="dol" name="dol">
        </div>

		<div class="rowElem">
		  <label for="Clmt-Own">Claimant Vehicle?</label>
		  <input type="checkbox" name="Clmt-Own" id="ClmtCheck" />
        </div>
        
        <h2>Insured Info</h2>
        
        <div class="rowElem">
        	<label for="insd">Insured:</label>
        	<input type="text" id="insd" name="insd">
        </div>
        
        <div class ="rowElem">
        	<label for="insd_add">Address:</label>
        	<input type="text" id="insd_add" name="insd_add">
        </div>
        
        <div class="rowElem">
        	<label for="insd_city">City:</label>
        	<input type="text" id="insd_city" name="insd_city">
        </div>
        
        <br>
        
        <div class="rowElem">
        	<label for="insd_st">State:</label>
        	<select name="insd_st" id="insd_st">
        		<option value="AL">AL</option>
				<option value="AK">AK</option>
				<option value="AZ">AZ</option>
				<option value="AR">AR</option>
				<option value="CA">CA</option>
				<option value="CO">CO</option>
				<option value="CT">CT</option>
				<option value="DE">DE</option>
				<option value="FL">FL</option>
				<option value="GA">GA</option>
				<option value="HI">HI</option>
				<option value="ID">ID</option>
				<option value="IL">IL</option>
				<option value="IN">IN</option>
				<option value="IA">IA</option>
				<option value="KS">KS</option>
				<option value="KY">KY</option>
				<option value="LA">LA</option>
				<option value="ME">ME</option>
				<option value="MD">MD</option>
				<option value="MA">MA</option>
				<option value="MI" selected="selected">MI</option>
				<option value="MN">MN</option>
				<option value="MS">MS</option>
				<option value="MO">MO</option>
				<option value="MT">MT</option>
				<option value="NE">NE</option>
				<option value="NV">NV</option>
				<option value="NH">NH</option>
				<option value="NJ">NJ</option>
				<option value="NM">NM</option>
				<option value="NY">NY</option>
				<option value="NC">NC</option>
				<option value="ND">ND</option>
				<option value="OH">OH</option>
				<option value="OK">OK</option>
				<option value="OR">OR</option>
				<option value="PA">PA</option>
				<option value="RI">RI</option>
				<option value="SC">SC</option>
				<option value="SD">SD</option>
				<option value="TN">TN</option>
				<option value="TX">TX</option>
				<option value="UT">UT</option>
				<option value="VT">VT</option>
				<option value="VA">VA</option>
				<option value="WA">WA</option>
				<option value="WV">WV</option>
				<option value="WI">WI</option>
				<option value="WY">WY</option>
        	</select>
        </div>
        
        <div class="rowElem">
        	<label for="insd-zip">Zip Code:</label>
        	<input type="text" name="insd-zip" id="insd-zip" minlength="5" maxlength="10">
        </div>
        
        <div class="rowElem">
        	<label for="insd-home">Home Phone:</label>
        	<input type="text" name="insd-home" id="insd-home" maxlength="12">
        </div>
        
        <div class="rowElem">
        	<label for="insd-work">Work Phone:</label>
        	<input type="text" name="insd-work" id="insd-work" maxlength="12">
        </div>
        
        <div class="rowElem">
        	<label for="insd-cell">Mobile Phone:</label>
        	<input type="text" name="insd-cell" id="insd-cell" maxlength="12">
        </div>
        
        <div class="rowElem">
        	<label for="insd-other">Other Phone:</label>
        	<input type="text" name="insd-other" id="insd-other" maxlength="12">
        </div>
        
        <br>
        
        <div id="Clmt-Info">
        	
        	<h2>Claimant Info</h2>
        	
        	<div class="rowElem">
	        	<label for="clmt">Claimant:</label>
	        	<input type="text" id="clmt" name="clmt">
	        </div>
	        
	        <div class ="rowElem">
	        	<label for="clmt_add">Address:</label>
	        	<input type="text" id="clmt_add" name="clmt_add">
	        </div>
	        
	        <div class="rowElem">
	        	<label for="clmt_city">City:</label>
	        	<input type="text" id="clmt_city" name="clmt_city">
	        </div>
	        
	        <br>
	        
	        <div class="rowElem">
	        	<label for="clmt_st">State:</label>
	        	<select name="clmt_st" id="clmt_st">
	        		<option value="AL">AL</option>
					<option value="AK">AK</option>
					<option value="AZ">AZ</option>
					<option value="AR">AR</option>
					<option value="CA">CA</option>
					<option value="CO">CO</option>
					<option value="CT">CT</option>
					<option value="DE">DE</option>
					<option value="FL">FL</option>
					<option value="GA">GA</option>
					<option value="HI">HI</option>
					<option value="ID">ID</option>
					<option value="IL">IL</option>
					<option value="IN">IN</option>
					<option value="IA">IA</option>
					<option value="KS">KS</option>
					<option value="KY">KY</option>
					<option value="LA">LA</option>
					<option value="ME">ME</option>
					<option value="MD">MD</option>
					<option value="MA">MA</option>
					<option value="MI" selected="selected">MI</option>
					<option value="MN">MN</option>
					<option value="MS">MS</option>
					<option value="MO">MO</option>
					<option value="MT">MT</option>
					<option value="NE">NE</option>
					<option value="NV">NV</option>
					<option value="NH">NH</option>
					<option value="NJ">NJ</option>
					<option value="NM">NM</option>
					<option value="NY">NY</option>
					<option value="NC">NC</option>
					<option value="ND">ND</option>
					<option value="OH">OH</option>
					<option value="OK">OK</option>
					<option value="OR">OR</option>
					<option value="PA">PA</option>
					<option value="RI">RI</option>
					<option value="SC">SC</option>
					<option value="SD">SD</option>
					<option value="TN">TN</option>
					<option value="TX">TX</option>
					<option value="UT">UT</option>
					<option value="VT">VT</option>
					<option value="VA">VA</option>
					<option value="WA">WA</option>
					<option value="WV">WV</option>
					<option value="WI">WI</option>
					<option value="WY">WY</option>
	        	</select>
	        </div>
	        
	        <div class="rowElem">
	        	<label for="clmt-zip">Zip Code:</label>
	        	<input type="text" name="clmt-zip" id="clmt-zip" minlength="5" maxlength="10">
	        </div>
	        
	           	<div class="rowElem">
				   	<label for="clmt-home">Home Phone:</label>
				   	<input type="text" name="clmt-home" id="clmt-home" maxlength="12">
				</div>
        
				<div class="rowElem">
					<label for="clmt-work">Work Phone:</label>
					<input type="text" name="clmt-work" id="clmt-work" maxlength="12">
				</div>
        
		        <div class="rowElem">
		        	<label for="clmt-cell">Mobile Phone:</label>
		        	<input type="text" name="clmt-cell" id="clmt-cell" maxlength="12">
		        </div>
		        
		        <div class="rowElem">
		        	<label for="clmt-other">Other Phone:</label>
		        	<input type="text" name="clmt-other" id="clmt-other" maxlength="12">
		        </div>
        </div>
        
        <br>
              
        <h2>Damaged Unit Information</h2>
        
        <div class="rowElem">
        	<label for="VIN">VIN:</label>
        	<input type="text" name="VIN" id="VIN" maxlength="17">
        </div>
        
        <div class="rowElem">
		  	<label for="veh-year">Year:</label>
		  	<input type="text" name="veh-year" id="veh-year" maxlength="4">
        </div>
        
        <div class="rowElem">
        	<label for="veh-make">Make:</label>
        	<input type="text" name="veh-make" id="veh-make">
        </div>
        
        <div class="rowElem">
        	<label for="veh-model">Model:</label>
        	<input type="text" name="veh-model" id="veh-model">
        </div>
        
        <div class="rowElem">
        	<label for="lic_pl">License Plate:</label>
        	<input type="text" name="lic_pl" id"lic_pl">
        </div>
        
        <div class="rowElem">
        	<label for="veh-color">Color:</label>
        	<input type="text" name="veh-color" id="veh-color">
        </div>
        
        <div class="rowElem">
		    <label>Unit Location:</label> 
		    
		    <div id="changeLocation">
		
    			<input type="radio" name="location" id="owner" value="With the Owner" checked="checked" />
    			<label for="owner">With the Owner</label>
    			
    			<div class="clear"></div>
				
				<label></label>
    			<input type="radio" name="location" id="alt-loc" name="loc" value="At Another Location" />
    			<label for="alt-loc">At Another Location (i.e. Body Shop, Tow Yard, Workplace)</label>
			
			</div>
        </div>
        
        <br>
        <div class="clear"></div>
        <br>
        <br>
        
        
        <div id="loc-info">
        	<div class="rowElem">
        		<label for="loc-name">Location Name:</label>
        		<input type="text" name="loc-name" id="loc-name">
        	</div>
        	
        	<div class="rowElem">
        		<label for="loc-add">Location Address:</label>
        		<input type="text" name="loc-add" id="loc-add">
        	</div>
        	
        	<div class="rowElem">
        		<label for="loc-city">Location City:</label>
        		<input type="text" name="loc-city" id="loc-city">
        	</div>
        	
        	<div class="rowElem">
	        	<label for="loc-st">State:</label>
	        	<select name="loc-st" id="loc-st">
	        		<option value="AL">AL</option>
					<option value="AK">AK</option>
					<option value="AZ">AZ</option>
					<option value="AR">AR</option>
					<option value="CA">CA</option>
					<option value="CO">CO</option>
					<option value="CT">CT</option>
					<option value="DE">DE</option>
					<option value="FL">FL</option>
					<option value="GA">GA</option>
					<option value="HI">HI</option>
					<option value="ID">ID</option>
					<option value="IL">IL</option>
					<option value="IN">IN</option>
					<option value="IA">IA</option>
					<option value="KS">KS</option>
					<option value="KY">KY</option>
					<option value="LA">LA</option>
					<option value="ME">ME</option>
					<option value="MD">MD</option>
					<option value="MA">MA</option>
					<option value="MI" selected="selected">MI</option>
					<option value="MN">MN</option>
					<option value="MS">MS</option>
					<option value="MO">MO</option>
					<option value="MT">MT</option>
					<option value="NE">NE</option>
					<option value="NV">NV</option>
					<option value="NH">NH</option>
					<option value="NJ">NJ</option>
					<option value="NM">NM</option>
					<option value="NY">NY</option>
					<option value="NC">NC</option>
					<option value="ND">ND</option>
					<option value="OH">OH</option>
					<option value="OK">OK</option>
					<option value="OR">OR</option>
					<option value="PA">PA</option>
					<option value="RI">RI</option>
					<option value="SC">SC</option>
					<option value="SD">SD</option>
					<option value="TN">TN</option>
					<option value="TX">TX</option>
					<option value="UT">UT</option>
					<option value="VT">VT</option>
					<option value="VA">VA</option>
					<option value="WA">WA</option>
					<option value="WV">WV</option>
					<option value="WI">WI</option>
					<option value="WY">WY</option>
	        	</select>
	        </div>
        	
        	<div class="rowElem">
        		<label for="loc-zip">Location Zip:</label>
        		<input type="text" name="loc-zip" id="loc-zip" minlength="5" maxlength="10">
        	</div>
        	
        	<div class="rowElem">
        		<label for="loc-con">Location Contact:</label>
        		<input type="text" name="loc-con" id="loc-con">
        	</div>
        	
        	<div class="rowElem">
        		<label for="loc-phone">Location Phone:</label>
        		<input type="text" name="loc-phone" id="loc-phone" maxlength="12">
        	</div>
        	
        </div>
        
        <br>
       
		<div class="rowElem">
		  <label for="desc-loss">Description of Loss:</label>
		  <textarea cols="40" rows="8" name="desc-loss"></textarea>
        </div>
       
		<div class="rowElem">
		  <label for="desc-dmg">Description of Damage:</label>
		  <textarea cols="40" rows="8" name="desc-dmg"></textarea>
        </div>
        
        <div class="rowElem">
		  <label for="spec-inst">Special Instructions:</label>
		  <textarea cols="40" rows="8" name="spec-inst"></textarea>
        </div>
        
		<div class="rowElem">
		  <label>   </label>
		  <input type="submit" value="Submit Request" />
        </div>
        
		<div class="rowElem">
		  <label>   </label>
		  <input type="reset" value="Reset" />
		</div>
        
        <div id="rowElem">
          <label>Click to Save:</label>
		  <input type="checkbox" name="save-company" />
		  <label for="save-company">Company Name</label>
        </div>
        
        <div class="clear"></div>
        
        <div id="rowElem">
        	<label>   </label>
        	<input type="checkbox" name="save-name" />
        	<label for="save-name">Adjuster's Name</label>
        </div>
        
        <div class="clear"></div>
        
        <div id="rowElem">
        	<label>   </label>
        	<input type="checkbox" name="save-email" />
        	<label for="save-email">Adjuster's E-mail</label>
        </div>
        
        <div class="clear"></div>
        
        <div id="rowElem">
        	<label>   </label>
        	<input type="checkbox" name="save-phone" />
        	<label for="save-phone">Adjuster's Phone</label>
        </div>
        			
	</form>
	
	</div>
	
	<script type="text/javascript">
	var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
	document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
	</script>
	<script type="text/javascript">
	var pageTracker = _gat._getTracker("UA-68528-29");
	pageTracker._initData();
	pageTracker._trackPageview();
	</script>

</body>

</html>
Link to comment
https://forums.phpfreaks.com/topic/293688-online-form-help/
Share on other sites

You admit that you know nothing about coding and yet you have done something that is supposed to satisfy CLIENTS already? Rather bold of you!

 

Would you take your car to a self-proclaimed auto mechanic who tells you that it is his first day trying to fix cars? Or a would you go to a doctor who is in his first day of med school?

 

What do you think learning how to program computers is all about?

Link to comment
https://forums.phpfreaks.com/topic/293688-online-form-help/#findComment-1501836
Share on other sites

Could you provide more information about what you mean by "...there are times that it transmits correctly, and times that it won't...". Does the script show any errors? Does it only send part of the message...if so, what's missing? Does it fail to send the message altogether?

Link to comment
https://forums.phpfreaks.com/topic/293688-online-form-help/#findComment-1501838
Share on other sites

First start off fixing all your html in your form, is many values missing an equals or even duplicate name.

 

<input type="text" id="req-phone" name="req-phone" class="required" maxlength="12" value="<?php echo $_COOKIE["NA-Phone"]; ?>" />

 

no name or value?

<input type="text" id="ext" />

 

<input type="text" id="fax" />

 

<div class="rowElemSelect">

 

<label for="policy">Policy #:</label>

 

<input type="text" name="lic_pl" id="lic_pl">

 

2 different names this one

<input type="radio" name="location" id="alt-loc" name="loc" value="At Another Location" />

 

Is a few other things but would require nearly starting over.

Link to comment
https://forums.phpfreaks.com/topic/293688-online-form-help/#findComment-1501867
Share on other sites

  • 1 month later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.