First time iam working with this type of form, spend two days but nothing worked. last date to submitting my project was on tomorrow please help me iam not an expert. I have removed some filed for shorten the form, I want the attachment files (3 files) need to uploaded and its name and other also need to be inserted with other form fields. Please don't down vote and iam an intermediate and spend three day to find an solution so please help.
if (isset($_POST['application']))
{
$branch=$_POST['branch'];
$gender=$_POST['gender'];
$fname=$_POST['fname'];
$lname=$_POST['lname'];
$paddress=$_POST['peaddress'];
$paddress_1=$_POST['peaddress2'];
$paddressp=$_POST['peaddresspin'];
$praddress=$_POST['prddress'];
$praddress1=$_POST['praddress2'];
$praddressp=$_POST['praddresspin'];
$mobile=$_POST['mobile'];
$phone=$_POST['phone'];
$house=$_POST['house'];
$job=$_POST['job'];
$income=$_POST['income'];
$gp_lati=$_POST['loclat'];
$gp_lngi=$_POST['loclng'];
$ap_adar = $_FILES['afile1']['name'];
$ap_pan = $_FILES['afile2']['name'];
$ap_gran = $_FILES['gfile']['name'];
$ap_id = $_SESSION['userid'];
if ($_FILES['file']['size'] <= 20000000)
{
$exp = _get_extension($file);
$filename = 'image_' . time() . rand(1000, 9999) . $exp;
$data = array('branch'=>$branch,'gen'=>$gender,'fname'=>$fname,'lname'=>$lname,'peaddress'=>$paddress,'peaddress2'=>$paddress_1,'peaddresspin'=>$paddressp,'prddress'=>$praddress,'praddress2'=>$praddress1,'praddresspin'=>$praddressp,'mobile'=>$mobile,'phone'=>$phone,'house'=>$house,'job'=>$job,'income'=>$income,'loclat'=>$gp_lati,'loclng'=>$gp_lngi,'apadr'=>$ap_adar,'appan'=>$ap_pan,'apgrn'=>$ap_gran);
$path = '../public/customer/' . $filename;
$uploadpathBig = '../customer/' . $filename;
if (move_uploaded_file($_FILES["file"]["tmp_name"], $path))
{
copy($path, $uploadpathBig);
$resizeObj = new resize($uploadpathBig);
$resizeObj1 = new resize($path);
$resizeObj->resizeImage(150,150, 'exact');
$resizeObj->saveImage($uploadpathBig, 100);
// $resizeObj1->resizeImage(680,386, 'exact');
//$resizeObj1->saveImage($path, 100);
$ins = $con->insert('customer', $data);
if ($ins == '1')
{
$sucess = '<div class="alert alert-success">
<button type="button" class="close" data-dismiss="alert">×</button>
<strong>Well done!</strong>Successfully Inserted Customer.
</div>';
header("location:user.php");
}else{
$error = '<div class="alert alert-danger">
<button type="button" class="close" data-dismiss="alert">×</button>
<strong>Oops!</strong>Something went wrong try again.
</div>';
header("location:app_ind.php");
}
}
}
?>
PHP FORM
<form class="form-horizontal style-form" name="form1" method="post" action="" onSubmit="return valid();">
<div class="text_desc">Branch</div>
<select id="cars" name="branch" >
<option value="">Select...</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
<div class="text_desc">Gender</div>
<input class="radio" type="checkbox" name="gender" value="male"> Male
<input class="radio" type="checkbox" name="gender" value="female">Female
<div class="text_desc">First Name</div>
<input type="text" name="fname">
<div class="text_desc">Last Name</div>
<input type="text" name="lname">
<div class="text_desc">Permanent Address </div>
<input type="text" name="peaddress">
<div class="text_desc">Permanent Address Line 2</div>
<input type="text" name="peaddress2">
<div class="text_desc">Mobile</div>
<input type="text" name="mobile" ng-model="user.mobile" onkeypress='return (event.charCode >= 48 && event.charCode <= 57 )||event.charCode == 43 '>
<div class="text_desc">GPS : <small>Turn on your mobile GPS and click Track location button.</small>
<input type="hidden" id="lat" name="loclat" class="form-control" placeholder="Customer Location Latitude" />
<input type="hidden" id="lng" name="loclng" class="form-control" placeholder="Customer Location Longitude" />
Applicant Aadhar<input name="files[afile1]" type="file" multiple /></li>
Applicant Pan Card <input name="files[afile2]" type="file" multiple /></li>
Grandeur Aadhar <input name="files[gfile]" type="file" multiple /></li>
<button id="btn-signup" type="submit" name="application" value="application" class="btn btn-info"><i class="icon-hand-right"></i>   Register</button>
</form>