我的javascript:
function updatedata(str){
var id = str;
var formData= new FormData($('#registrationform'+str)[0]);//serialize all form data including the file data
$.ajax({
url: "update_registration.php?id="+id,//php page to process all form data
type: 'POST',
data: formData,
async: false,
success: function (data) {
$('#info2').html(data);//div where data are displayed
viewdata();
},
cache: false,
contentType: false,
processData: false
});
return false;
}
我的html页面:
<table class="table table-bordered table-hover">
<thead>
<tr>
<th style="text-align:center; border-bottom:hidden" valign="top" class="info"><span class="info" style="text-align:center">Reg No.</span></th>
<th style="text-align:center; border-bottom:hidden" valign="top" class="info"><span class="info" style="text-align:center">Picture</span></th>
<th style="text-align:center; border-bottom:hidden" valign="top" class="info"><span class="info" style="text-align:center">Course</span></th>
<th style="text-align:center; border-bottom:hidden" valign="top" class="info">Class Code</th>
<th colspan="2" style="text-align:center; border-bottom:hidden" valign="top" class="info"><span class="info" style="text-align:center">Course Schedule </span></th>
<th colspan="3" style="text-align:center; border-bottom:hidden" valign="top" class="info"><span class="info" style="text-align:center">Full Name</span></th>
<th style="text-align:center; border-bottom:hidden" valign="top" class="info"><span class="info" style="text-align:center">Municipality/City</span></th>
<th style="text-align:center; border-bottom:hidden" valign="top" class="info"><span class="info" style="text-align:center">Company Sponsor</span></th>
<th style="text-align:center; border-bottom:hidden" valign="top" class="info"><span class="info" style="text-align:center">Date Of Registration</span></th>
<th style="text-align:center; border-bottom:hidden" valign="top" class="info"><span class="info" style="text-align:center">Approved By</span></th>
<th colspan="2" style="text-align:center; border-bottom:hidden" valign="top" class="info"><span class="info" style="text-align:center">Action</span></th>
</tr>
</thead>
<tbody>
<?php
include "connect_database.php";
$fetchquery9 = "SELECT * FROM `registration`";
$fetch9 = mysqli_query($conn, $fetchquery9);
while($row = mysqli_fetch_assoc($fetch9))
{
?>
<tr style="text-align:center">
<td><?php echo $row['reg_number']; ?></td>
<?php echo "<td>".'<img src="data:image/jpeg;base64,'.base64_encode( $row['picture'] ).'" />'." </td>";?>
<td><?php echo $row['course']; ?></td>
<td><?php echo $row['class_code']; ?></td>
<td><?php echo $row['start_date_reg']; ?></td><td><?php echo $row['end_date_reg']; ?></td>
<td style="border-right:hidden"><?php echo $row['surname']; ?></td>
<td style="border-right:hidden"><?php echo $row['first_name']; ?></td>
<td><?php echo $row['middle_name']; ?></td>
<td><?php echo $row['municipality_city']; ?></td>
<td><?php echo $row['company_sponsor']; ?></td>
<td><?php echo $row['date_of_reg']; ?></td>
<td><?php echo $row['approved_by']; ?></td>
<td style="border-right:hidden"><a class="btn btn-warning btn-sm" data-toggle="modal" data-backdrop="static" data-keyboard="false" data-target="#myModal<?php echo $row['reg_number']; ?>"><span class="glyphicon glyphicon-pencil" aria-hidden="true"></span></a></td>
<td><a class="btn btn-danger btn-sm data-toggle=confirmation data-popout=true" onclick="deletedata('<?php echo $row['reg_number']; ?>')"><span class="glyphicon glyphicon-trash" aria-hidden="true"></span></a></td>
<!-- Modal -->
<div class="modal fade" id="myModal<?php echo $row['reg_number']; ?>" tabindex="-1" role="dialog" aria-labelledby="myModalLabel<?php echo $row['reg_number']; ?>" aria-hidden="true">
<div class="modal-dialog" style="width:80%" >
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="myModalLabel<?php echo $row['reg_number']; ?>">Edit Data</h4>
</div>
<br/>
<div id="info3" align="center"></div>
<br/>
<div class="modal-body">
<form id="registrationform<?php echo $row['reg_number']; ?>" method="post" enctype="multipart/form-data">
<div class="row">
<div class="col-md-8">
</div>
<div class="col-md-4">
<div class="form-group">
<img id="image<?php echo $row['reg_number']; ?>" src="data:image/jpeg;base64,<?php echo base64_encode($row['picture']); ?>" alt="Click to Upload an Image" style="max-height:192px; max-width:192px; min-height:192px; max-width:192px; width:192px; height:192px; text-align:center; line-height:192px; vertical-align:central" onClick="uploadedit('<?php echo $row['reg_number']; ?>')"/>
<input type="file" name="file" id="file<?php echo $row['reg_number']; ?>" style="display:none" onchange="previewedit('<?php echo $row['reg_number']; ?>');" accept="image/jpeg,image/x-png" class="form-control"/>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="col-md-2">
<div class="form-group">
<label for="registrationno">Registration No.</label>
<input type="number" min="0" id="registrationno<?php echo $row['reg_number']; ?>" value="<?php echo $row['reg_number']; ?>" name="registrationno" class="form-control">
</div>
</div>
</div>
</div>
<input type="hidden" id="hidden3<?php echo $row['reg_number']; ?>" value="<?php echo $row['reg_number']; ?>" name="hidden3" class="form-control">
<div class="row">
<div class="col-md-4">
<div class="form-group">
<label for="course">Course</label>
<select type="text" id="course<?php echo $row['reg_number']; ?>" value="<?php echo $row['course']; ?>" onchange="getfeex('<?php echo $row['reg_number']; ?>');" name="course" class="form-control">
<option value="<?php echo $row['course']; ?>"><?php echo $row['course']; ?></option>
<?php
include "connect_database.php";
$fetchquery = "SELECT `course_description` FROM `list_of_courses` ORDER BY `course_description`";
$fetch = mysqli_query($conn, $fetchquery);
while ($rows = mysqli_fetch_assoc($fetch))
{
echo "<option value=\"".$rows['course_description']."\">".$rows['course_description']."</option>";
}
?>
</select>
</div>
</div>
<input type="hidden" id="hidden2<?php echo $row['reg_number']; ?>" value="<?php echo $row['course']; ?>" name="hidden2" class="form-control">
<div class="col-md-4">
<div class="col-md-9">
<div class="form-group">
<label for="classcode">Class Code</label>
<input type="text" id="classcode<?php echo $row['reg_number']; ?>" value="<?php echo $row['class_code']; ?>" name="classcode" class="form-control">
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<a href="class_list_form.php"><span class="glyphicon glyphicon-list-alt"></span> view class list</a>
</div>
</div>
</div>
<input type="hidden" id="hidden<?php echo $row['reg_number']; ?>" value="<?php echo $row['class_code']; ?>" name="hidden" class="form-control">
<div class="col-md-4">
<div class="form-group">
<label for="dateofregistration">Date of Registration</label>
<input type="date" id="dateofregistration<?php echo $row['reg_number']; ?>" value="<?php echo $row['date_of_reg']; ?>" name="dateofregistration" class="form-control" readonly>
</div>
</div>
</div>
<div class="row">
<div class="col-md-8">
<div class="form-group">
<label for="companysponsor">Company Sponsor</label>
<input type="text" id="companysponsor<?php echo $row['reg_number']; ?>" value="<?php echo $row['company_sponsor']; ?>" name="companysponsor" class="form-control">
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label for="telno">Tel No.</label>
<input type="number" min="0" id="telno<?php echo $row['reg_number']; ?>" value="<?php echo $row['tel_no']; ?>" name="telno" class="form-control">
</div>
</div>
</div>
<div class="row">
<div class="col-md-4">
<div class="form-group">
<label for="surname">Surname</label>
<input type="text" id="surname<?php echo $row['reg_number']; ?>" value="<?php echo $row['surname']; ?>" name="surname" class="form-control">
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label for="firstname">First Name</label>
<input type="text" name="firstname" id="firstname<?php echo $row['reg_number']; ?>" value="<?php echo $row['first_name']; ?>" class="form-control">
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label for="middlename">Middle Name</label>
<input type="text" id="middlename<?php echo $row['reg_number']; ?>" value="<?php echo $row['middle_name']; ?>" name="middlename" class="form-control">
</div>
</div>
</div>
<div class="row">
<div class="col-md-4">
<div class="form-group">
<label for="email">Email</label>
<input type="email" id="email<?php echo $row['reg_number']; ?>" value="<?php echo $row['email']; ?>" name="email" class="form-control">
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label for="cellphone">Cellphone No.</label>
<input type="number" min="0" id="cellphone<?php echo $row['reg_number']; ?>" value="<?php echo $row['cellphone']; ?>" name="cellphone" class="form-control">
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label for="landline">Landline</label>
<input type="number" min="0" id="landline<?php echo $row['reg_number']; ?>" value="<?php echo $row['land_line']; ?>" name="landline" class="form-control">
</div>
</div>
</div>
<div class="row">
<div class="col-md-8">
<div class="form-group">
<label for="street">Street No. and Street Name</label>
<input type="number" min="0" id="street<?php echo $row['reg_number']; ?>" value="<?php echo $row['st_no_and_st_name']; ?>" name="street" class="form-control">
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label for="barangay">Barangay</label>
<input type="text" id="barangay<?php echo $row['reg_number']; ?>" value="<?php echo $row['brgy']; ?>" name="barangay" class="form-control">
</div>
</div>
</div>
<div class="row">
<div class="col-md-4">
<div class="form-group">
<label for="municipalitycity">Municipality/City</label>
<input type="text" id="municipalitycity<?php echo $row['reg_number']; ?>" value="<?php echo $row['municipality_city']; ?>" name="municipalitycity" class="form-control">
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label for="district">District</label>
<input type="text" id="district<?php echo $row['reg_number']; ?>" value="<?php echo $row['district']; ?>" name="district" class="form-control">
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label for="province">Province</label>
<input type="text" id="province<?php echo $row['reg_number']; ?>" value="<?php echo $row['province']; ?>" name="province" class="form-control">
</div>
</div>
</div>
<div class="row">
<div class="col-md-4">
<div class="form-group">
<label for="nationality">Nationality</label>
<input type="text" id="nationality<?php echo $row['reg_number']; ?>" value="<?php echo $row['nationality']; ?>" name="nationality" class="form-control">
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label for="birthplace">Birthplace</label>
<input type="text" id="birthplace<?php echo $row['reg_number']; ?>" value="<?php echo $row['birthplace']; ?>" name="birthplace" class="form-control">
</div>
</div>
<div class="col-md-2">
<div class="form-group">
<label for="dateofbirth">Date of Birth</label>
<input type="date" id="dateofbirth<?php echo $row['reg_number']; ?>" value="<?php echo $row['date_of_birth']; ?>" name="dateofbirth" class="form-control">
</div>
</div>
<div class="col-md-2">
<div class="form-group">
<label for="sex">Gender</label>
<select name="sex" id="sex<?php echo $row['reg_number']; ?>" value="<?php echo $row['sex']; ?>" class="form-control">
<option value="<?php echo $row['reg_number']; ?>"><?php echo $row['sex']; ?></option>
<option value="Male">Male</option>
<option value="Female">Female</option>
</select>
</div>
</div>
</div>
<div class="row">
<div class="col-md-2">
<div class="form-group">
<label for="age">Age</label>
<input type="number" min="0" id="age<?php echo $row['reg_number']; ?>" value="<?php echo $row['age']; ?>" name="age" class="form-control">
</div>
</div>
<div class="col-md-2">
<div class="form-group">
<label for="civilstatus">Civil Status</label>
<select type="text" id="civilstatus<?php echo $row['reg_number']; ?>" value="<?php echo $row['civil_status']; ?>" name="civilstatus" class="form-control">
<option value="<?php echo $row['reg_number']; ?>"><?php echo $row['civil_status']; ?></option>
<option value="Single">Single</option>
<option value="Married">Married</option>
<option value="Divorced">Divorced</option>
<option value="Widowed">Widowed</option>
</select>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label for="persontocontact">Person to contact incase of emergency</label>
<input type="text" id="persontocontact<?php echo $row['reg_number']; ?>" value="<?php echo $row['person_to_contact']; ?>" name="persontocontact" class="form-control">
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label for="contactno">Contact No.</label>
<input type="number" min="0" id="contactno<?php echo $row['reg_number']; ?>" value="<?php echo $row['contactno']; ?>" name="contactno" class="form-control">
</div>
</div>
</div>
<div class="row">
<div class="col-md-4">
<div class="form-group">
<label for="educationalattainment">Educational Attainment</label>
<input type="text" id="educationalattainment<?php echo $row['reg_number']; ?>" value="<?php echo $row['highest_educational_attainment']; ?>" name="educationalattainment" class="form-control">
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label for="school">School/Training Center</label>
<input type="text" id="school<?php echo $row['reg_number']; ?>" value="<?php echo $row['school']; ?>" name="school" class="form-control">
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label for="coursedegree">Course/Degree</label>
<input type="text" id="coursedegree<?php echo $row['reg_number']; ?>" value="<?php echo $row['course_degree']; ?>" name="coursedegree" class="form-control">
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<p class="col-md-12" style="font-size:x-large; color:#009 ;font-weight:bold!important">COURSES TAKEN (Kitchen/Galley Related Trainings)</p>
</div>
</div>
<div class="row">
<div class="col-md-2">
<div class="form-group">
<label>Tittle of Course</label>
<input type="text" class="form-control" id="titleofcourse1<?php echo $row['reg_number']; ?>" value="<?php echo $row['title_of_course1']; ?>" name="titleofcourse1"/><br>
<input type="text" class="form-control" id="titleofcourse2<?php echo $row['reg_number']; ?>" value="<?php echo $row['title_of_course2']; ?>" name="titleofcourse2"/><br>
<input type="text" class="form-control" id="titleofcourse3<?php echo $row['reg_number']; ?>" value="<?php echo $row['title_of_course3']; ?>" name="titleofcourse3"/><br>
</div>
</div>
<div class="col-md-2">
<div class="form-group">
<label>Month and Year Taken</label>
<input type="month" class="form-control" id="yeartaken1<?php echo $row['reg_number']; ?>" value="<?php echo $row['year_taken1']; ?>" name="yeartaken1"/><br>
<input type="month" class="form-control" id="yeartaken2<?php echo $row['reg_number']; ?>" value="<?php echo $row['year_taken2']; ?>" name="yeartaken2"/><br>
<input type="month" class="form-control" id="yeartaken3<?php echo $row['reg_number']; ?>" value="<?php echo $row['year_taken3']; ?>" name="yeartaken3"/><br>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label>School Training Center</label>
<input type="text" class="form-control" id="trainingcenter1<?php echo $row['reg_number']; ?>" value="<?php echo $row['school_training_center1']; ?>" name="trainingcenter1"/><br>
<input type="text" class="form-control" id="trainingcenter2<?php echo $row['reg_number']; ?>" value="<?php echo $row['school_training_center2']; ?>" name="trainingcenter2"/><br>
<input type="text" class="form-control" id="trainingcenter3<?php echo $row['reg_number']; ?>" value="<?php echo $row['school_training_center3']; ?>" name="trainingcenter3"/><br>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label>Certificates Achieved</label>
<input type="text" class="form-control" id="certifications1<?php echo $row['reg_number']; ?>" value="<?php echo $row['certifications_achieved1']; ?>" name="certifications1"/><br>
<input type="text" class="form-control" id="certifications2<?php echo $row['reg_number']; ?>" value="<?php echo $row['certifications_achieved2']; ?>" name="certifications2"/><br>
<input type="text" class="form-control" id="certifications3<?php echo $row['reg_number']; ?>" value="<?php echo $row['certifications_achieved3']; ?>" name="certifications3"/><br>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12" align="center">
<p class="col-md-12" style="font-size:x-large; color:#009 ;font-weight:bold!important">ACCOUNTING</p>
</div>
</div>
<div class="row">
<div class="col-md-4">
<div class="col-md-6">
<p>Approved by</p><input type="text" class="form-control" id="name<?php echo $row['reg_number']; ?>" value="<?php echo $row['approved_by']; ?>" name="name" readonly/>
</div>
</div>
<div class="col-md-2">
<div class="form-group">
<div class="col-md-12">
<div class="form-group">
<input type="radio" name="choice" value="Cash" id="cash" onChange="radiobutton1x('<?php echo $row['reg_number']; ?>');">
<label for="cashamount">Cash</label>
<input type="number" min="0" class="form-control" name="cashamount" id="cashamount<?php echo $row['reg_number']; ?>" value="<?php echo $row['amount_cash']; ?>" onchange="x('<?php echo $row['reg_number']; ?>');" readonly/>
</div>
</div>
</div>
</div>
<div class="col-md-2">
<div class="form-group">
<div class="col-md-12">
<div class="form-group">
<input type="radio" name="choice" value="Check" id="check" onChange="radiobutton2x('<?php echo $row['reg_number']; ?>');">
<label for="check_no">Check No.</label>
<input type="number" min="0" class="form-control" name="check_no" id="check_no<?php echo $row['reg_number']; ?>" value="<?php echo $row['check_no']; ?>" readonly/>
</div>
</div>
<div class="col-md-12">
<div class="form-group">
<label for="bank">Bank</label>
<input type="text" class="form-control" id="bank<?php echo $row['reg_number']; ?>" value="<?php echo $row['bank']; ?>" name="bank" readonly/>
</div>
</div>
<div class="col-md-12">
<div class="form-group">
<label for="check_amount">Amount</label>
<input type="number" min="0" class="form-control" id="checkamount<?php echo $row['reg_number']; ?>" value="<?php echo $row['amount_check']; ?>" name="checkamount" onchange="y('<?php echo $row['reg_number']; ?>');" readonly/>
</div>
</div>
</div>
</div>
<div class="col-md-2">
<div class="form-group">
<div class="col-md-12">
<div class="form-group">
<input type="radio" name="choice" value="Card" id="cards" onChange="radiobutton3x('<?php echo $row['reg_number']; ?>');">
<label for="card">Card</label>
<input type="text" class="form-control" name="card" id="card<?php echo $row['reg_number']; ?>" value="<?php echo $row['card']; ?>" readonly/>
</div>
</div>
<div class="col-md-12">
<div class="form-group">
<label>Type</label>
<input type="type" class="form-control" id="cardtype<?php echo $row['reg_number']; ?>" value="<?php echo $row['card_type']; ?>" name="cardtype" readonly/>
</div>
</div>
<div class="col-md-12">
<div class="form-group">
<label>Appr Code</label>
<input type="text" class="form-control" id="appr_code<?php echo $row['reg_number']; ?>" value="<?php echo $row['appr_code']; ?>" name="appr_code" readonly/>
</div>
</div>
<div class="col-md-12">
<div class="form-group">
<label for="card_amount">Amount</label>
<input type="number" min"0" class="form-control" id="card_amount<?php echo $row['reg_number']; ?>" value="<?php echo $row['amount_card']; ?>" name="card_amount" onchange="z('<?php echo $row['reg_number']; ?>');" readonly/>
</div>
</div>
</div>
</div>
<div class="col-md-2">
<div class="form-group">
<div class="col-md-12">
<div class="form-group">
<label for="charge">Charge</label>
<select type="text" class="form-control" id="charge<?php echo $row['reg_number']; ?>" value="<?php echo $row['charge']; ?>" name="charge">
<option value="<?php echo $row['reg_number']; ?>"><?php echo $row['charge']; ?></option>
<option value="Personal">Personal</option>
<option value="Company">Company</option>
</select>
</div>
</div>
<div class="col-md-12">
<div class="form-group">
<label for="modeofpayment">Payment</label>
<select type="text" class="form-control" id="modeofpayment<?php echo $row['reg_number']; ?>" value="<?php echo $row['mode_of_payment']; ?>" name="modeofpayment">
<option value="<?php echo $row['reg_number']; ?>"><?php echo $row['mode_of_payment']; ?></option>
<option value="Full">Full</option>
<option value="Partial">Partial</option>
</select>
</div>
</div>
<div class="col-md-12">
<div class="form-group">
<label>Tuition</label>
<input type="text" class="form-control" id="tuition<?php echo $row['reg_number']; ?>" value="<?php echo $row['tuition']; ?>" name="tuition"/>
</div>
</div>
<div class="col-md-12">
<div class="form-group">
<label for="balance">Balance</label>
<input type="text" class="form-control" id="balance<?php echo $row['reg_number']; ?>" value="<?php echo $row['balance']; ?>" name="balance" />
</div>
</div>
</div>
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal" onclick="viewdata();">Close</button>
<button type="button" onclick="updatedata('<?php echo $row['reg_number']; ?>')" class="btn btn-primary">Update</button>
</div>
</div>
</div>
</div>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
PHP
<?php print_r($_POST);; print_r($_FILES) ?> //print all post
我希望看到所有表单数据都显示在数组中作为新formData的结果,但它只显示了Array()。 我猜它找不到表单元素因为表单id上的+ str 我应该更改以查看数组中的所有表单?
答案 0 :(得分:0)
HTML:
<form action="." method="post" id="form">
<input type="text" name="name" value="Ajay">
<input type="text" name="location" value="Chennai">
<button id="button">Button</button>
</form>
<div class="frmData">POST Values printed here..</div>
jQuery的: 此函数应位于文档就绪函数内。
$('#button').click(function(){
var frmData = $('#form').serialize();
$('.frmData').html(frmData);
});
答案 1 :(得分:0)
找到了另一种解决方案
function updatedata(str){
var id = str;
var registrationno = $('#registrationno'+str).val();
var course = $('#course'+str).val();
var classcode = $('#classcode'+str).val();
var dateofregistration = $('#dateofregistration'+str).val();
var companysponsor = $('#companysponsor'+str).val();
var telno = $('#telno'+str).val();
var surname = $('#surname'+str).val();
var firstname = $('#firstname'+str).val();
var middlename = $('#middlename'+str).val();
var email = $('#email'+str).val();
var cellphone = $('#cellphone'+str).val();
var landline = $('#landline'+str).val();
var street = $('#street'+str).val();
var barangay = $('#barangay'+str).val();
var municipalitycity = $('#municipalitycity'+str).val();
var district = $('#district'+str).val();
var province = $('#province'+str).val();
var nationality = $('#nationality'+str).val();
var birthplace = $('#birthplace'+str).val();
var dateofbirth = $('#dateofbirth'+str).val();
var sex = $('#sex'+str).val();
var age = $('#age'+str).val();
var civilstatus = $('#civilstatus'+str).val();
var persontocontact = $('#persontocontact'+str).val();
var contactno = $('#contactno'+str).val();
var educationalattainment = $('#educationalattainment'+str).val();
var school = $('#school'+str).val();
var coursedegree = $('#coursedegree'+str).val();
var nameofcompany1 = $('#nameofcompany1'+str).val();
var nameofcompany2 = $('#nameofcompany2'+str).val();
var nameofcompany3 = $('#nameofcompany3'+str).val();
var typeofcompany1 = $('#typeofcompany1'+str).val();
var typeofcompany2 = $('#typeofcompany2'+str).val();
var typeofcompany3 = $('#typeofcompany3'+str).val();
var datefrom1 = $('#datefrom1'+str).val();
var datefrom2 = $('#datefrom2'+str).val();
var datefrom3 = $('#datefrom3'+str).val();
var dateto1 = $('#dateto1'+str).val();
var dateto2 = $('#dateto2'+str).val();
var dateto3 = $('#dateto3'+str).val();
var position1 = $('#position1'+str).val();
var position2 = $('#position2'+str).val();
var position3 = $('#position3'+str).val();
var titleofcourse1 = $('#titleofcourse1'+str).val();
var titleofcourse2 = $('#titleofcourse2'+str).val();
var titleofcourse3 = $('#titleofcourse3'+str).val();
var yeartaken1 = $('#yeartaken1'+str).val();
var yeartaken2 = $('#yeartaken2'+str).val();
var yeartaken3 = $('#yeartaken3'+str).val();
var trainingcenter1 = $('#trainingcenter1'+str).val();
var trainingcenter2 = $('#trainingcenter2'+str).val();
var trainingcenter3 = $('#trainingcenter3'+str).val();
var certifications1 = $('#certifications1'+str).val();
var certifications2 = $('#certifications2'+str).val();
var certifications3 = $('#certifications3'+str).val();
var cashamount = $('#cashamount'+str).val();
var charge = $('#charge'+str).val();
var modeofpayment = $('#modeofpayment'+str).val();
var tuition = $('#tuition'+str).val();
var balance = $('#balance'+str).val();
var card = $('#card').val();
var cardtype = $('#cardtype'+str).val();
var card_amount = $('#card_amount'+str).val();
var appr_code = $('#appr_code'+str).val();
var bank = $('#bank'+str).val();
var check_no = $('#check_no'+str).val();
var checkamount = $('#checkamount'+str).val();
var hidden = $('#hidden'+str).val();
var hidden2 = $('#hidden2'+str).val();
var hidden3 = $('#hidden3'+str).val();
var $form = $('#myModal'+str),
formData = new FormData(),
files = $form.find('[name="file"]')[0].files;
$.each(files, function(i, file) {
// Prefix the name of uploaded files with "uploadedFiles-"
// Of course, you can change it to any string
formData.append('file', file);
});
$.ajax({
url: "update_registration.php?registrationno="+registrationno+"&course="+course+"&classcode="+classcode+"&dateofregistration="+dateofregistration+"&companysponsor="+companysponsor+"&telno="+telno+"&surname="+surname+"&firstname="+firstname+"&middlename="+middlename+"&email="+email+"&cellphone="+cellphone+"&landline="+landline+"&street="+street+"&barangay="+barangay+"&municipalitycity="+municipalitycity+"&district="+district+"&province="+province+"&nationality="+nationality+"&birthplace="+birthplace+"&dateofbirth="+dateofbirth+"&sex="+sex+"&age="+age+"&civilstatus="+civilstatus+"&persontocontact="+persontocontact+"&contactno="+contactno+"&educationalattainment="+educationalattainment+"&school="+school+"&coursedegree="+coursedegree+"&nameofcompany1="+nameofcompany1+"&nameofcompany2="+nameofcompany2+"&nameofcompany3="+nameofcompany3+"&typeofcompany1="+typeofcompany1+"&typeofcompany2="+typeofcompany2+"&typeofcompany3="+typeofcompany3+"&datefrom1="+datefrom1+"&datefrom2="+datefrom2+"&datefrom3="+datefrom3+"&dateto1="+dateto1+"&dateto2="+dateto2+"&dateto3="+dateto3+"&position1="+position1+"&position2="+position2+"&position3="+position3+"&titleofcourse1="+titleofcourse1+"&titleofcourse2="+titleofcourse2+"&titleofcourse3="+titleofcourse3+"&yeartaken1="+yeartaken1+"&yeartaken2="+yeartaken2+"&yeartaken3="+yeartaken3+"&trainingcenter1="+trainingcenter1+"&trainingcenter2="+trainingcenter2+"&trainingcenter3="+trainingcenter3+"&certifications1="+certifications1+"&certifications2="+certifications2+"&certifications3="+certifications3+"&cashamount="+cashamount+"&charge="+charge+"&modeofpayment="+modeofpayment+"&tuition="+tuition+"&balance="+balance+"&card="+card+"&cardtype="+cardtype+"&card_amount="+card_amount+"&appr_code="+appr_code+"&bank="+bank+"&check_no="+check_no+"&checkamount="+checkamount+"&hidden="+hidden+"&hidden2="+hidden2+"&hidden3="+hidden3+"&id="+id,
type: 'POST',
data: formData,
async: false,
success: function (data) {
$('#info2').html(data);
viewdata();
},
cache: false,
contentType: false,
processData: false
});
return false;}