Jump to content

Recommended Posts

Hi..

 

Im new to php..

This is my form validate code..

im getting errors...i did my best to do this code

 

Can anyone help me and correct my code

 

<?php
session_start();
// submit button clicked
if(isset($_POST['submit'])){
$errors=array();
// Continue when clicked
if(isset($_POST['Role'], $_POST['Name'], $_POST['datepicker'], $_POST['gender'], $_POST['activity'], $_POST['Address'], $_POST['Photo'], $_POST['Biodata'], $_POST['certificates'], $_POST['Salary'])){
// Fields are all set else error : No errors conintue
// Set variables an sanitise
$Emp_Save= mysql_real_escape_string($_POST['Emp_Save']); // Sanitise 
$Emp_Cancel=$_POST['Emp_Cancel']; // Sanitise 
$Role=$_POST['Role']; // Sanitise 
$Name=$_POST['Name']; // Sanitise 
$datepicker=$_POST['datepicker']; // Sanitise 
$gender=$_POST['gender']; // Sanitise 
$activity=$_POST['activity']; // Sanitise 
$Address=$_POST['Address']; // Sanitise 
$Photo=$_POST['Photo']; // Sanitise 
$Biodata=$_POST['Biodata']; // Sanitise 
$certificates=$_POST['certificates']; // Sanitise 
$Salary=$_POST['Salary']; // Sanitise 

//-- Continue with error checks ;;

if($_Role == ""){
$errors[]='Please Select The Employee Role!';
}

if(strlen($Name >30){
$errors[]='Name Is Too Long!';
}
else if(empty($Name))
{
$errors[]='Please Fill The Field!';
}


// Vslidate Datepicker
if(strlen($datepicker) != 10){
$errors[]='Date should only be 10 characters and number .';
}
// explode datepaicker by what ever youre using to separate them
$datepicker_ex = explode('/', $datepicker);
// Check that theyre numbers
if(!is_numeric($datepicker_ex[0]) || !is_numeric($datepicker_ex[1]) || !is_numeric($datepicker_ex[2])){
$errors[]='Date should only be number .';
} else {
// they are number format them back and cast to int , just incase
$datepicker = (int)$datepicker_ex[0].'/'.(int)$datepicker_ex[1].'/'.(int)$datepicker_ex[2];
}
// END - date picker valiadation

else if($gender == ""){
$errors[]='Please Select The Gender!';
}

else if($Activity == ""){
$errors[]='Please Select the Status!';
}

else if($Address == ""){
$errors[]='Please Enter The Address!';


if(array_key_exists('Photo', $_FILES)) {
$allowed_filetypes = array('.jpg','.gif','.bmp','.png','.jpeg');
$ext = substr($filename, strpos($filename,'.'), strlen($filename)-1);
// Validate the uploaded file
if($_FILES['Photo']['size'] === 0 
|| empty($_FILES['Photo']['tmp_name'])) {
echo("<p>No file was selected.</p>\r\n");
} else if($_FILES['Photo']['size'] > 50000) {
echo("<p>The file was too large.</p>\r\n");
} else if($_FILES['Photo']['error'] !== UPLOAD_ERR_OK) {
// There was a PHP error
echo("<p>There was an error uploading.</p>\r\n");
// Check if the filetype is allowed, if not DIE and inform the user.
if(!in_array($ext,$allowed_filetypes))
die('The file you attempted to upload is not allowed.');
}




if(array_key_exists('Biodata', $_FILES)) {
$allowed_filetypes = array('.pdf');
$ext = substr($filename, strpos($filename,'.'), strlen($filename)-1);
// Validate the uploaded file
if($_FILES['Biodata']['size'] === 0 
|| empty($_FILES['Biodata']['tmp_name'])) {
echo("<p>No file was selected.</p>\r\n");
} else if($_FILES['Biodata']['size'] > 50000) {
echo("<p>The file was too large.</p>\r\n");
} else if($_FILES['Biodata']['error'] !== UPLOAD_ERR_OK) {
// There was a PHP error
echo("<p>There was an error uploading.</p>\r\n");
if(!in_array($ext,$allowed_filetypes))
die('The file you attempted to upload is not allowed.');
} 


if(array_key_exists('certificates', $_FILES)) {
$allowed_filetypes = array('.pdf');
$ext = substr($filename, strpos($filename,'.'), strlen($filename)-1);
// Validate the uploaded file
if($_FILES['certificates']['size'] === 0 
|| empty($_FILES['certificates']['tmp_name'])) {
echo("<p>No file was selected.</p>\r\n");
} else if($_FILES['certificates']['size'] > 50000) {
echo("<p>The file was too large.</p>\r\n");
} else if($_FILES['certificates']['error'] !== UPLOAD_ERR_OK) {
// There was a PHP error
echo("<p>There was an error uploading.</p>\r\n");
if(!in_array($ext,$allowed_filetypes))
die('The file you attempted to upload is not allowed.');
} 


elseif($_EmpSalary == ""){
$errors[]='Please Enter The Salary!';
}

//----- End error checks do insert or display errors of any are found --
if(empty($errors)){
// do insert
$query = mysql_query("INSERT INTO `formdetails` (role,name,,date_of_birth,gender,activity,address,photo,biodata,certificates,salary) VALUES ('$Role', '$Name','$datepicker',, '$gender','$activity','$Address','$Photo','$Biodata','$certificates','$_EmpSalary')");

} else {
foreach($errors as $error){
// display errors
echo $error;
}
}

//---------------------------------------------------
} else {
$errors[]= 'All fields required.';
}
}
// END --
?>

 

MOD EDIT:

 . . . 

BBCode tags added.

Link to comment
https://forums.phpfreaks.com/topic/255938-form-validation-error-in-php/
Share on other sites

well, you didn't say what the error was, but by running it through an online validator tool like http://www.piliapp.com/php-syntax-check/ returns many errors including missing parenthesis for if statements and malformed if/else blocks (else if after an else)

there are some things that I noticed right off the bat that I will mention since you are new at this.

 

1. comments are meant to let others and yourself know why a certain block of code is there, not what it does, we can see what it does from looking at the code. Sanitizing a variable and then placing a comment next to it saying "sanitize" is simply a waste of time.

 

2. in your code you set $_POST['role'] to the variable $Role, then further down you reference it as $_Role.

 

if($_Role == ""){

 

$_Role does not exist.

 

3. since this is a good bit of code, it would be helpful if you told us exactly what errors are being triggered so we can pinpoint the snippets of code that are relevant.

Im not getting any output...

 

I just did the form validation..like..

 

1.check all the fields whether they r empty??

 

2.validate datepicker

 

3.validate biodata,certificates fields whether they r empty,uploading file size,file format like it shud upload only pdf format..

 

4.validate photo whether they r empty,uploading file size,file format like it shud upload only jpeg,jpg,bmp,gif,png format..

 

I CORRETCED THE CODE..

 

but still not getting the output..

 

<?php
session_start();
// submit button clicked
if(isset($_POST['submit'])){
    $errors=array();
    // Continue when clicked
    if(isset($_POST['Role'], $_POST['Name'], $_POST['datepicker'], $_POST['gender'], $_POST['activity'], $_POST['Address'], $_POST['Photo'], $_POST['Biodata'], $_POST['certificates'], $_POST['Salary'])){
        // Fields are all set else error : No errors conintue
        // Set variables an sanitise
        $Emp_Save= mysql_real_escape_string($_POST['Emp_Save']);   // Sanitise 
        $Emp_Cancel=$_POST['Emp_Cancel'];   // Sanitise 
        $Role=$_POST['Role'];   // Sanitise 
        $Name=$_POST['Name'];   // Sanitise 
        $datepicker=$_POST['datepicker'];   // Sanitise 
        $gender=$_POST['gender'];   // Sanitise 
        $activity=$_POST['activity'];   // Sanitise 
        $Address=$_POST['Address'];   // Sanitise 
        $Photo=$_POST['Photo'];   // Sanitise 
        $Biodata=$_POST['Biodata'];   // Sanitise 
        $certificates=$_POST['certificates'];   // Sanitise 
        $Salary=$_POST['Salary'];   // Sanitise 
        
        //-- Continue with error checks ;;
        
        if($_Role == ""){
             $errors[]='Please Select The Employee Role!';
        }
        
                else if(strlen($Name >30)){
             $errors[]='Name Is Too Long!';
          }
         else if(empty($Name))
          {
              $errors[]='Please Fill The Field!';
          }
                  
                        
        // Vslidate Datepicker
       else if(strlen($datepicker) != 10){
            $errors[]='Date should only be 10 characters and number .';
        }
        // explode datepaicker by what ever youre using to separate them
        $datepicker_ex = explode('/', $datepicker);
        // Check that theyre numbers
        if(!is_numeric($datepicker_ex[0]) || !is_numeric($datepicker_ex[1]) || !is_numeric($datepicker_ex[2])){
            $errors[]='Date should only be number .';
        } else {
            // they are number format them back and cast to int , just incase
            $datepicker = (int)$datepicker_ex[0].'/'.(int)$datepicker_ex[1].'/'.(int)$datepicker_ex[2];
        }
        // END - date picker valiadation
        
                 if(empty($gender)){
             $errors[]='Please Select The Gender!';
                   }

         if(empty($Activity)){
            $errors[]='Please Select the Status!';
         }
                 
         if(empty($Address)){
            $errors[]='Please Enter The Address!';
        
                
                 if(array_key_exists('Photo', $_FILES)) {
$allowed_filetypes = array('.jpg','.gif','.bmp','.png','.jpeg');
$ext = substr($filename, strpos($filename,'.'), strlen($filename)-1);
// Validate the uploaded file
if($_FILES['Photo']['size'] === 0 
|| empty($_FILES['Photo']['tmp_name'])) {
echo("<p>No file was selected.</p>\r\n");
} else if($_FILES['Photo']['size'] > 50000) {
echo("<p>The file was too large.</p>\r\n");
} else if($_FILES['Photo']['error'] !== UPLOAD_ERR_OK) {
// There was a PHP error
echo("<p>There was an error uploading.</p>\r\n");
// Check if the filetype is allowed, if not DIE and inform the user.
if(!in_array($ext,$allowed_filetypes))
die('The file you attempted to upload is not allowed.');
}




if(array_key_exists('Biodata', $_FILES)) {
$allowed_filetypes = array('.pdf');
$ext = substr($filename, strpos($filename,'.'), strlen($filename)-1);
// Validate the uploaded file
if($_FILES['Biodata']['size'] === 0 
|| empty($_FILES['Biodata']['tmp_name'])) {
echo("<p>No file was selected.</p>\r\n");
} else if($_FILES['Biodata']['size'] > 50000) {
echo("<p>The file was too large.</p>\r\n");
} else if($_FILES['Biodata']['error'] !== UPLOAD_ERR_OK) {
// There was a PHP error
echo("<p>There was an error uploading.</p>\r\n");
if(!in_array($ext,$allowed_filetypes))
die('The file you attempted to upload is not allowed.');
} 


if(array_key_exists('certificates', $_FILES)) {
$allowed_filetypes = array('.pdf');
$ext = substr($filename, strpos($filename,'.'), strlen($filename)-1);
// Validate the uploaded file
if($_FILES['certificates']['size'] === 0 
|| empty($_FILES['certificates']['tmp_name'])) {
echo("<p>No file was selected.</p>\r\n");
} else if($_FILES['certificates']['size'] > 50000) {
echo("<p>The file was too large.</p>\r\n");
} else if($_FILES['certificates']['error'] !== UPLOAD_ERR_OK) {
// There was a PHP error
echo("<p>There was an error uploading.</p>\r\n");
if(!in_array($ext,$allowed_filetypes))
die('The file you attempted to upload is not allowed.');
} 
                
      
     if(empty($_EmpSalary)){
          $errors[]='Please Enter The Salary!';
      }
          
          //-----  End error checks do insert or display errors of any are found --
        if(empty($errors)){
            // do insert
            $query = mysql_query("INSERT INTO `formdetails` (role,name,,date_of_birth,gender,activity,address,photo,biodata,certificates,salary) VALUES ('$Role', '$Name','$datepicker',, '$gender','$activity','$Address','$Photo','$Biodata','$certificates','$_EmpSalary')");
            
        } else {
            foreach($errors as $error){
                //  display errors
                echo $error;
            }
        }
        
        //---------------------------------------------------
    } else {
        $errors[]= 'All fields required.';
    }
}
//  END --
?>

 

MOD EDIT:

 . . . 

BBCode tags added.

Why have you sent this to me in a PM?

 

I havent even commented on this thread. Doing stuff like that is more likely to piss me off than make me want to help you. If you must randomly PM me at least have the curtesy to introduce yourself explain why you are PMing me with a bunch of code.

 

:facewall:

This is my validation.php code

<?php
//session_start(); 
require_once("config.php");

error_reporting(E_ALL ^ E_NOTICE ^ E_WARNING);

if(isset($_POST['Emp_Save'])){
   $errors=array();
   // Continue when clicked	
   if(isset($_POST['_EmpRole'], $_POST['_EmpName'],$_POST['_EmpFatherName'],$_POST['datepicker'],$_POST['_EmpMaritalStatus'],$_POST['Gender'],$_POST['EmpActivityRadio'],$_POST['_EmpAddress'],$_POST['_EmpQuali'],$_FILES['_EmpPhoto2']['name'],$_FILES['_EmpBiodata']['name'],$_POST['_DOJoin'],$_FILES['_EmpIDProof']['name'],$_FILES['_EmpMedIns']['name'],$_POST['_EmpSalary'])) 
{
       // Fields are all set else error : No errors conintue
       // Set variables an sanitise
       $Emp_Save= mysql_real_escape_string($_POST['Emp_Save']);  
      $Emp_Cancel=$_POST['Emp_Cancel'];
$_EmpRole=$_POST['_EmpRole'];
$_EmpName=$_POST['_EmpName'];
$_EmpFatherName=$_POST['_EmpFatherName'];
$datepicker=$_POST['datepicker'];
$_EmpMaritalStatus=$_POST['_EmpMaritalStatus'];
$Gender=$_POST['Gender'];
$EmpActivityRadio=$_POST['EmpActivityRadio'];
$_EmpAddress=$_POST['_EmpAddress'];
$_EmpQuali=$_POST['_EmpQuali'];
$_EmpPhoto2=$_FILES['_EmpPhoto2']['name'];
$_EmpBiodata=$_FILES['_EmpBiodata']['name'];
$_DOJoin=$_POST['_DOJoin'];
$_EmpIDProof=$_FILES['_EmpIDProof']['name'];
$_EmpMedIns=$_FILES['_EmpMedIns']['name'];
$_EmpSalary=$_POST['_EmpSalary'];


       //-- Continue with error checks ;;

     
                if(strlen($_EmpName >30)){
            $errors[].='Name Is Too Long!';
         }
        else if(empty($_EmpName))
         {
             $errors[].='Please Fill The Field!<br />';
         }
     

          
               if(strlen($_EmpFatherName >30)){
            $errors[].='Name Is Too Long!<br />';
         }
        else if(empty($_EmpFatherName))
         {
             $errors[].='Please Fill The Field!<br />';
         }

               
        

        if(empty($_EmpAddress)){
           $errors[].='Please Enter The Address!<br />';
	   }
	   
	   if(empty($_EmpQuali)){
           $errors[].='Please Enter The Qualification!<br />';
	   } 
	   
	//Make files directory
$target_files="files";
if (!is_dir($target_files)){
mkdir($target_files, 0700);
}

                if(array_key_exists('_EmpPhoto2', $_FILES)) { 
$filename = stripslashes($_FILES['_EmpPhoto2']['name']);
$allowed_filetypes = array('.jpg','.gif','.bmp','.png','.jpeg','.JPEG','.JPG');
$ext = substr($filename, strpos($filename,'.'), strlen($filename)-1);
// Validate the uploaded file
if($_FILES['_EmpPhoto2']['size'] === 0
|| empty($_FILES['_EmpPhoto2']['tmp_name'])) {
$errors[].="No file was selected.<br />\r\n";
}
if($_FILES['_EmpPhoto2']['size'] > 5242880) {
$errors[].="The Photo was too large.<br />\r\n";
}
if($_FILES['_EmpPhoto2']['error'] !== UPLOAD_ERR_OK) {
// There was a PHP error
$errors[].="There was an error uploading.<br />\r\n";
}
// Check if the filetype is allowed, if not DIE and inform the user.
if(!in_array($ext,$allowed_filetypes)){
$errors[].="The Photo file you attempted to upload is not allowed.<br />\r\n";
//die();
}
else{
$target_path_EmpPhoto2="files/_EmpPhoto2";
if (!is_dir($target_path_EmpPhoto2)){
mkdir($target_path_EmpPhoto2, 0700);
}
if (is_dir($target_path_EmpPhoto2)){
move_uploaded_file($_FILES["_EmpPhoto2"]["tmp_name"], $target_path_EmpPhoto2 ."/". $filename);
}

$_EmpPhoto2=$filename;
}
}


             
if(array_key_exists('_EmpBiodata', $_FILES)) {	
$filename = stripslashes($_FILES['_EmpBiodata']['name']);
$allowed_filetypes = array('.pdf','.PDF');
$ext = substr($filename, strpos($filename,'.'), strlen($filename)-1);
// Validate the uploaded file
if($_FILES['_EmpBiodata']['size'] === 0
|| empty($_FILES['_EmpBiodata']['tmp_name'])) {
$errors[].="No file was selected.<br />\r\n";
}
if($_FILES['_EmpBiodata']['size'] > 5242880) {
$errors[].="The Biodata file was too large.<br />\r\n";
}
if($_FILES['_EmpBiodata']['error'] !== UPLOAD_ERR_OK) {
// There was a PHP error
$errors[].="There was an error uploading.<br />\r\n";
}
if(!in_array($ext,$allowed_filetypes)){
$errors[].="The Biodata file you attempted to upload is not allowed.<br />\r\n";
//die();
}
else{
$target_path_EmpBiodata="files/_EmpBiodata";
if (!is_dir($target_path_EmpBiodata)){
mkdir($target_path_EmpBiodata, 0700);
}
if (is_dir($target_path_EmpBiodata)){
move_uploaded_file($_FILES["_EmpBiodata"]["tmp_name"], $target_path_EmpBiodata ."/". $filename);
}

$_EmpBiodata=$filename;
}
}











if(array_key_exists('_EmpMedIns', $_FILES)) {	
$filename = stripslashes($_FILES['_EmpMedIns']['name']);
$allowed_filetypes = array('.pdf','.PDF');
$ext = substr($filename, strpos($filename,'.'), strlen($filename)-1);
// Validate the uploaded file
if($_FILES['_EmpMedIns']['size'] === 0
|| empty($_FILES['_EmpMedIns']['tmp_name'])) {
$errors[].="No file was selected.<br />\r\n";
}
if($_FILES['_EmpMedIns']['size'] > 5242880) {
$errors[].="The Med Ins file was too large.<br />\r\n";
}
if($_FILES['_EmpMedIns']['error'] !== UPLOAD_ERR_OK) {
// There was a PHP error
$errors[].="There was an error uploading.<br />\r\n";
}
if(!in_array($ext,$allowed_filetypes)){
$errors[].="The Med Ins file you attempted to upload is not allowed.<br />\r\n";
//die();
}
else{
$target_path_EmpMedIns="files/_EmpMedIns";
if (!is_dir($target_path_EmpMedIns)){
mkdir($target_path_EmpMedIns, 0700);
}
if (is_dir($target_path_EmpMedIns)){
move_uploaded_file($_FILES["_EmpMedIns"]["tmp_name"], $target_path_EmpMedIns ."/". $filename);
}

$_EmpMedIns=$filename;
}
}



if(array_key_exists('_EmpIDProof', $_FILES)) {	
$filename = stripslashes($_FILES['_EmpIDProof']['name']);
$allowed_filetypes = array('.pdf','.PDF');
$ext = substr($filename, strpos($filename,'.'), strlen($filename)-1);
// Validate the uploaded file
if($_FILES['_EmpIDProof']['size'] === 0
|| empty($_FILES['_EmpIDProof']['tmp_name'])) {
$errors[].="No file was selected.<br />\r\n";
}
if($_FILES['_EmpIDProof']['size'] > 5242880) {
$errors[].="The ID proof file was too large.<br />\r\n";
}
if($_FILES['_EmpIDProof']['error'] !== UPLOAD_ERR_OK) {
// There was a PHP error
$errors[].="There was an error uploading.<br />\r\n";
}
if(!in_array($ext,$allowed_filetypes)){
$errors[].="The IDproof file you attempted to upload is not allowed.<br />\r\n";
//die();
}
else{
$target_path_EmpIDproof="files/_EmpIDProof";
if (!is_dir($target_path_EmpIDproof)){
mkdir($target_path_EmpIDproof, 0700);
}
if (is_dir($target_path_EmpIDproof)){
move_uploaded_file($_FILES["_EmpIDProof"]["tmp_name"], $target_path_EmpIDproof ."/". $filename);
}

$_EmpIDproof=$filename;
}
}



   if(empty($_EmpSalary)){
         $errors[].='Please Enter The Salary!<br />';
     }

         //-----  End error checks do insert or display errors of any are found --
       if(empty($errors)){
   //After verifying data, this is where you sanitize
$_EmpRole = mysql_real_escape_string($_EmpRole);
$_EmpName = mysql_real_escape_string($_EmpName);
$_EmpFatherName = mysql_real_escape_string($_EmpFatherName);
$datepicker = mysql_real_escape_string($datepicker);
$_EmpMaritalStatus = mysql_real_escape_string($_EmpMaritalStatus);
$Gender = mysql_real_escape_string($Gender);
$EmpActivityRadio = mysql_real_escape_string($EmpActivityRadio);
$_EmpAddress = mysql_real_escape_string($_EmpAddress);
$_EmpQuali = mysql_real_escape_string($_EmpQuali);
$_EmpPhoto2 = mysql_real_escape_string($_EmpPhoto2);
$_EmpBiodata = mysql_real_escape_string($_EmpBiodata);
$_DOJoin = mysql_real_escape_string($_DOJoin);
$_EmpIDproof = mysql_real_escape_string($_EmpIDproof);
$_EmpMedIns = mysql_real_escape_string($_EmpMedIns);
$_EmpSalary = mysql_real_escape_string($_EmpSalary);
           // do insert
           $query = mysql_query("INSERT INTO `employeedetails` (emp_role,name,fathername,date_of_birth,marital_status,gender,activity_status,address,qualification,photo,bio_data,date_of_joining,id_proof,medical_insurance_details,salary) VALUES ('$_EmpRole', '$_EmpName','$_EmpFatherName','$datepicker','$_EmpMaritalStatus','$Gender','$EmpActivityRadio','$_EmpAddress','$_EmpQuali','$_EmpPhoto2','$_EmpBiodata','$_DOJoin','$_EmpIDproof','$_EmpMedIns','$_EmpSalary')");

      
       }//if(empty($errors))

       //---------------------------------------------------
   } else {
       $errors[].= 'All fields required.';
   }
}
//  END -- 
?>

 

This is my form.php code

<?php
session_start();
include("config.php");
include("validation.php");
?>
<form action="" method="POST" enctype="multipart/form-data" name="TabForm1" target="_self">
        <p>          </p>
        <table width="911" height="128" border="1">
          <tr>
            <td width="417">  Name            :            
                     
		  <input name="_EmpName" type="text" id="_EmpName" size="35" maxlength="35" value="<?php if (isset($_POST['_EmpName'])){ echo "{$_POST['_EmpName']}"; }?>" /></td>
            <td width="478"><label>  Surname :   </label>
              <input name="_EmpFatherName" type="text" id="_EmpFatherName" size="35" maxlength="35" value="<?php if (isset($_POST['_EmpFatherName'])){ echo "{$_POST['_EmpFatherName']}"; }?>" /></td>
          </tr>
          <tr>
            <td><label>  Date Of Birth :        </label>
              <input type="text" name="datepicker" id="datepicker" />
              <script type="text/javascript">
  					$("#datepicker").AnyTime_picker( { format: "  %D %M %z " ,askEra:false,labelTitle: "Select a Date"});
          </script></td>
             <td rowspan="4"><br /> Photo :        
               
             <input type="file" id="files" name="_EmpPhoto2" multiple accept="image/*" />
             <br />       
             <output id="list"></output>
             <script>
             function handleFileSelect(evt) 
		 {
                var files = evt.target.files; // FileList object
                // Loop through the FileList and render image files as thumbnails.
                for (var i = 0, f; f = files[i]; i++) 
			{
                    // Only process image files.
                    if (!f.type.match('image.*')) {
                    continue;
                    }
                    var reader = new FileReader();
                    // Closure to capture the file information.
                    reader.onload = (function(theFile) {
                                    return function(e) {
                    // Render thumbnail.
                    var CurrPic = document.createElement('span');
	            CurrPic.setAttribute("id","DispPic");
	            // document.getElementById('list').removeChild(CurrPic);
                    CurrPic.innerHTML = ['<img class="thumb" src="', e.target.result,
                            '" title="', theFile.name, '"/>'].join('');		
                    var child=document.getElementById('list').firstChild;
	            if (child != null){
	                document.getElementById('list').replaceChild(CurrPic, child);
				}else{		
	                 document.getElementById('list').insertBefore(CurrPic, null);
	            }

                };
                })(f);

                // Read in the image file as a data URL.
                reader.readAsDataURL(f);
                }
              }

              document.getElementById('files').addEventListener('change', handleFileSelect, false);
              </script>
              </p>
              <p>                          
</p></td>
          </tr>
          <tr>
            <td>  Gender       :                 <span id="EmpGenderRadio3">
              <label>     
                 
                <input name="Gender" type="radio" id="Gender_2" value="Male" checked="checked" />
                Male</label>
              <label>     
                <input type="radio" name="Gender" value="Female" id="Gender_3" />
                Female</label>
            </span></td>
            </tr>
          <tr>
            <td>  Marital Status   :      
              <select name="_EmpMaritalStatus" size="1" id="_EmpMaritalStatus">
                <option value="0" selected="selected">Single</option>
                <option value="1">Married</option>
                <option value="2">Divorced</option>
                <option value="3">Widowed</option>
              </select></td>
            </tr>
          <tr>
            <td>  Address   :                  
              <label>
                <textarea name="_EmpAddress" id="_EmpAddress" cols="42" rows="3"><?php if (isset($_POST['_EmpAddress'])){ echo "{$_POST['_EmpAddress']}"; }?></textarea>
              </label></td>
            </tr>
                        <tr>
            <td width="418">  ID Proof     :                
              <input type="file" name="_EmpIDProof" id="_EmpIDProof" accept="application/pdf" /></td>
            <td width="476" height="37">   Medical Insurance Details  :  
              <input type="file" name="_EmpMedIns" id="_EmpMedIns" accept="application/pdf" /></td>
          </tr>        
          <tr>
            <td colspan="2">   Activity Status :         <span id="spryradio2">
            <label>   
              <input name="EmpActivityRadio" type="radio" id="EmpActivityRadio_0" value="0" checked="checked" />
              Active</label>
            <label>  
              <input type="radio" name="EmpActivityRadio" value="1" id="EmpActivityRadio_1" />
              Non Active</label>
            </span></td>
            </tr>
          <tr>
            <td width="419"><label> </label>
  Qualification    :       
<input name="_EmpQuali" type="text" id="_EmpQuali" size="35" maxlength="35" value="<?php if (isset($_POST['_EmpQuali'])){ echo "{$_POST['_EmpQuali']}"; }?>" /></td>
            <td width="479">   Biodata     :             
              <input type="file" name="_EmpBiodata" id="_EmpBiodata" accept="application/pdf" /></td>
          </tr>
          <tr>
            <td>   Role        :                   
              <select name="_EmpRole" size="1" id="_EmpRole">
                <option value="0">Administrator</option>
                <option value="1">Manager</option>
                <option value="2">Employee</option>
        </select></td>
            <td> </td>
          </tr>
          <tr>
            <td>  Date of Joining :      
<input type="text" name="_DOJoin" id="datepicker_2" />
              <script type="text/javascript">
  					$("#datepicker_2").AnyTime_picker( { format: "  %D %M %z " ,askEra:false,labelTitle: "Select a Date"});
          </script></td>
            <td>  Salary  :                   
              <input name="_EmpSalary" type="text" id="_EmpSalary" value="0" /></td>
          </tr>
        </table>
        <p>
          <label>             </label>
                                                                                                                                                </p>
        <p>
          <input type="submit" name="Emp_Save" id="Emp_Save" value="               Save                    "  class="EmpFormButton"/>
                              
          <input type="reset" name="Emp_Cancel" id="Emp_Cancel" value="              Cancel                 "  class="EmpFormButton"/>
        </p>
<p>            </p>
            <p>            </p>
            <p>            </p>
            <p>           </p>
            <p> </p>
          </form>                      

 

 

Guest
This topic is now closed to further replies.
×
×
  • 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.