I'm getting the following error message:
Warning: Missing argument 3 for DB::update(), called in C:\xampp\htdocs\my.sleeptrak.com\users\step-1-edit.php on line 51 and defined in C:\xampp\htdocs\my.sleeptrak.com\users\classes\DB.php on line 261
Here is my db.php:
public function update($table, $id, $fields){
$sql = "UPDATE {$table} SET " . (empty($fields) ? "" : "`") . implode("` = ? , `", array_keys($fields)) . (empty($fields) ? "" : "` = ? ");
$is_ok = true;
if (!is_array($id)) {
$sql .= "WHERE id = ?";
$fields[] = $id;
} else {
if (empty($id))
return false;
if ($where_text = $this->_calcWhere($id, $fields, "and", $is_ok))
$sql .= "WHERE $where_text";
}
if ($is_ok)
if (!$this->query($sql, $fields)->error())
return true;
return false;
}
And here is my edit.php
<form class="needs-validation" method="post">
<div class="offset-2 col-md-8 order-md-1">
<div class="card">
<div class="card-body">
<?php
if(isset($_POST['save'])) {
$fields = array(
"PatientFirstName" => $_POST['PatientFirstName'],
"PatientLastName" => $_POST['PatientLastName'],
"PatientStreet" => $_POST['PatientStreet'],
"PatientCity" => $_POST['PatientCity'],
"PatientProvince" => $_POST['PatientProvince'],
"PatientPostalCode" => $_POST['PatientPostalCode'],
"PatientCountry" => $_POST['PatientCountry'],
"PatientEmail" => $_POST['PatientEmail'],
"PatientPhone" => $_POST['PatientPhone'],
"PatientDOB" => $_POST['PatientDOB'],
"PatientBMI" => $_POST['PatientBMI'],
"PhysicianName" => $_POST['PhysicianName'],
"PhysicianEmail" => $_POST['PhysicianEmail']
);
$db->update("patients", $fields);
//print_r($db->errorInfo());
echo '<div class="alert alert-success mb-4" role="alert">The patient has been successfully updated!</div>';
} else {
?>
<h4 class="mb-3">Edit Patient <?php echo $PatientFirstName . ' ' . $PatientLastName; ?></h4>
<div class="row">
<div class="col-md-6 mb-3">
<label for="PatientFirstName">Patient first name</label>
<input type="text" class="form-control" name="PatientFirstName" value="<?php echo $PatientFirstName; ?>">
<div class="invalid-feedback">Valid first name is required.</div>
</div>
<div class="col-md-6 mb-3">
<label for="PatientLastName">Patient last name</label>
<input type="text" class="form-control" name="PatientLastName" value="<?php echo $PatientLastName; ?>">
<div class="invalid-feedback">Valid last name is required.</div>
</div>
</div>
<div class="row">
<div class="col-md-4 mb-3">
<label for="PatientDOB">Patient DOB</label>
<input type="date" class="form-control" name="PatientDOB" value="<?php echo $PatientDOB; ?>">
</div>
<div class="col-md-4 mb-3">
<label for="email">Email</label>
<input type="text" class="form-control" name="PatientEmail" value="<?php echo $PatientFirstName; ?>">
</div>
<div class="col-md-4 mb-3">
<label for="PatientPhone">Phone</label>
<input type="text" class="form-control" name="PatientPhone" value="<?php echo $PatientPhone; ?>">
<div class="invalid-feedback">Valid last name is required.</div>
</div>
</div>
</div><!--card-body-->
</div><!--card-->
<div class="card mt-3">
<div class="card-body">
<h4>Patient Address</h4>
<div class="row">
<div class="col-md-8 mb-3">
<label for="PatientStreet">Street</label>
<input type="text" class="form-control" name="PatientStreet" value="<?php echo $PatientStreet; ?>">
<div class="invalid-feedback">Valid address is required.</div>
</div>
<div class="col-md-4 mb-3">
<label for="PatientCity">City</label>
<input type="text" class="form-control" name="PatientCity" value="<?php echo $PatientCity; ?>">
<div class="invalid-feedback">
City is required.
</div>
</div>
</div>
<div class="row">
<div class="col-md-4 mb-3">
<label for="state">Province / State</label>
<input type="text" class="form-control" name="PatientProvince" value="<?php echo $PatientProvince; ?>">
<div class="invalid-feedback">
Please provide a valid province/state.
</div>
</div>
<div class="col-md-3 mb-3">
<label for="PatientPostalCode">Postal Code / Zip</label>
<input type="text" class="form-control" name="PatientPostalCode" value="<?php echo $PatientPostalCode; ?>">
<div class="invalid-feedback">
Postal Code / Zip Code is required.
</div>
</div>
<div class="col-md-5 mb-3">
<label for="PatientCountry">Country</label>
<input type="text" class="form-control" name="PatientCountry" value="<?php echo $PatientCountry; ?>">
<div class="invalid-feedback">
Please select a valid country.
</div>
</div>
</div>
</div><!--card-body-->
</div><!--card-->
<div class="card mt-3">
<div class="card-body">
<h4>Body Mass Index</h4>
<div class="row">
<div class="col-md-6 mb-3">
<label for="PatientBMI">Patient BMI</label>
<input type="text" class="form-control" name="PatientBMI" value="<?php echo $PatientBMI; ?>">
</div>
</div>
</div><!--card-body-->
</div><!--card-->
<div class="card mt-3">
<div class="card-body">
<div class="row">
<div class="col-md-6 mb-3">
<label for="PhysicianName">Physician Name</label>
<input type="text" class="form-control" name="PhysicianName" value="<?php echo $PhysicianName; ?>">
<div class="invalid-feedback">Valid last name is required.</div>
</div>
<div class="col-md-6 mb-3">
<label for="PhysicianEmail">Physician Email</label>
<input type="text" class="form-control" name="PhysicianEmail" value="<?php echo $PhysicianEmail; ?>">
</div>
</div>
</div><!--card-body-->
</div><!--card-->
<button class="btn btn-primary btn-lg btn-block mt-4" name="save" type="submit">Update</button>
</div>
</form>
I research all same errors on this form but i can't fix it. I tried to replace this: php public function update($table, $id, $field) with this public function update($table, $id, $fields=null) but is not working for me. How ever, the error is gone when i put null in function but still don't save in db my changes.
you have to write all arguments for update method
$db->update("patients", $id, $fields);
you missed $id.
Related
When I add an additional field to my query, it fails. I have checked the spelling 20 or more times....I do not know what is wrong.. Please help!!
Working code BELOW
if(isset($_POST['UPDATE_RAW'])) {
extract($_POST);
$sql=mysqli_query($db,"update nma_raw set NMA_System='$nmasystem',NMA_Ticket_Number='$nmaticketnum',Tkt_Priority='$tktpriority',Created_On_Worklist='$createdonworklist',Create_Date='$createdate',Create_Time='$createtime',Days_Old='$daysold',Interval_Onlist='$intervalonlist',Check_Status='$checkstatus',Ticket_Status='$ticketstatus',Relate_Status='$relatestatus',WFA_TR_Num='$wfatrnum',Recent_WFA_Dispatch_Status='$recentwfadispatchstatus',Last_Owner='$lastowner',Entity_Status='$entitystatus',Entity='$entity',First_Cond_Type='$firstcondtype',Last_Cond_Type='$lastcondtype',State='$st',CLLI='$clli',Check_Active='$checkactive',Check_Jepd='$checkjepd' WHERE ID='$id'");
if($sql) {
echo "<script>alert('Updated SuccessFully');window.location.href='Active_Tkt_Qry_List_Frm_NMA.php';</script>";
}
else {
echo "<script>alert('Some ERRORS');</script>";
}
}
NOT WORKING CODE BELOW!
if(isset($_POST['UPDATE_RAW'])) {
extract($_POST);
$sql = mysqli_query($db,"update nma_raw set NMA_System='$nmasystem',NMA_Ticket_Number='$nmaticketnum',Tkt_Priority='$tktpriority',Created_On_Worklist='$createdonworklist',Create_Date='$createdate',Create_Time='$createtime',Days_Old='$daysold',Interval_Onlist='$intervalonlist',Check_Status='$checkstatus',Ticket_Status='$ticketstatus',Relate_Status='$relatestatus',WFA_TR_Num='$wfatrnum',Recent_WFA_Dispatch_Status='$recentwfadispatchstatus',Last_Owner='$lastowner',Entity_Status='$entitystatus',Entity='$entity',First_Cond_Type='$firstcondtype',Last_Cond_Type='$lastcondtype',State='$st',CLLI='$clli',Check_Active='$checkactive',Check_Jepd='$checkjepd', Resolved_Date='$resolved_date' WHERE ID='$id'");
if($sql) {
echo "<script>alert('Updated SuccessFully');window.location.href='Active_Tkt_Qry_List_Frm_NMA.php';</script>";
}
else {
echo "<script>alert('Some ERRORS');</script>";
}
}
HERE IS A PICTURE OF MY DB SCHEMA
enter image description here
HERE IS THE TOTAL PHP FILE
<?php include_once "header.php";?>
<section class="content">
<div class="page-body clearfix">
<?php
$id=$_REQUEST['id'];
$sql=mysqli_query($db,"SELECT NMA_RAW.*, NMA_RAW.Check_Status, NMA_RAW.Resolved_Date, NMA_RAW.Filtered_Date FROM NMA_RAW WHERE (((NMA_RAW.Check_Status)='OK') AND ((NMA_RAW.Resolved_Date) Is Null) AND ((NMA_RAW.Filtered_Date) Is Null)) AND NMA_RAW.ID = $id;");
$row = mysqli_fetch_array($sql);
?>
<div class="panel panel-default">
<div class="panel-heading">NMA Active Ticket Form</div>
<div class="panel-body">
<form class="form-horizontal" action="" method="post">
<div class="form-group">
<div class="col-sm-4">
<label>NMA System</label>
<input type="text" id="nma_system" class="form-control" placeholder="NMA System" value="<?= $row['NMA_System']; ?>" name="nmasystem">
</div>
<div class="col-sm-4">
<label>NMA Ticket Number</label>
<input type="text" id="nma_ticket_number" class="form-control" placeholder="NMA Ticket Number" value="<?= $row['NMA_Ticket_Number']; ?>" name="nmaticketnum">
</div>
<div class="col-sm-4">
<label>Ticket Priority</label>
<input type="text" id="ticket_priority" class="form-control" placeholder="Ticket Priority" value="<?= $row['Tkt_Priority']; ?>" name="tktpriority">
</div>
</div>
<div class="form-group">
<div class="col-sm-4">
<label>Created On Worklist</label>
<input type="text" id="created_on_work_list" class="form-control" placeholder="Created On Worklist" value="<?= $row['Created_On_Worklist']; ?>" name="createdonworklist">
</div>
<div class="col-sm-4">
<label>Created Date</label>
<div class="input-group">
<span class="input-group-addon">
<i class="fa fa-calendar"></i>
</span>
<input type="date" id="created_date" class="form-control" placeholder="Created Date" value="<?= $row['Create_Date']; ?>" name="createdate">
</div>
</div>
<div class="col-sm-4">
<label>Created time</label>
<div class="input-group">
<span class="input-group-addon">
<i class="fa fa-calendar"></i>
</span>
<input type="time" id="created_time" class="form-control" placeholder="Created Time" value="<?= $row['Create_Time']; ?>" name="createtime">
</div>
</div>
</div>
<div class="form-group">
<div class="col-sm-4">
<label>Days Old</label>
<input type="text" id="days_old" class="form-control" placeholder="Days old" value="<?= $row['Days_Old']; ?>" name="daysold">
</div>
<div class="col-sm-4">
<label>Check</label>
<input type="text" id="check" class="form-control" placeholder="Check" value="<?= $row['Check_Status']; ?>" name="checkstatus">
</div>
<div class="col-sm-4">
<label>Ticket Status</label>
<input type="text" id="ticket_status" class="form-control" placeholder="Ticket Status" value="<?= $row['Ticket_Status']; ?>" name="ticketstatus">
</div>
</div>
<div class="form-group">
<div class="col-sm-4">
<label>Interval</label>
<input type="text" id="interval" class="form-control" placeholder="Interval" value="<?= $row['Interval_Onlist']; ?>" name="intervalonlist">
</div>
<div class="col-sm-4">
<label>Related Status</label>
<input type="text" id="relate_status" class="form-control" placeholder="Relate Status" value="<?= $row['Relate_Status']; ?>" name="relatestatus">
</div>
<div class="col-sm-4">
<label>WFA TR Num</label>
<input type="text" id="wfa_tr_num" class="form-control" placeholder="WF TR Num" value="<?= $row['WFA_TR_Num']; ?>" name="wfatrnum">
</div>
</div>
<div class="form-group">
<div class="col-sm-4">
<label>Recent WFA Dispatch Status</label>
<input type="text" id="recent_wfa_dispatch_status" class="form-control" placeholder="Recent WFA Dispatch Status"
value="<?= $row['Recent_WFA_Dispatch_Status']; ?>" name="recentwfadispatchstatus">
</div>
<div class="col-sm-4">
<label>Entity Status</label>
<input type="text" id="entity_status" class="form-control" placeholder="Intity Status" value="<?= $row['Entity_Status']; ?>" name="entitystatus">
</div>
<div class="col-sm-4">
<label>Entity</label>
<input type="text" name="entity" id="entity" class="form-control" placeholder="Entity" value="<?= $row['Entity']; ?>" name="entity">
</div>
</div>
<div class="form-group">
<div class="col-sm-4">
<label>Last Owner</label>
<input type="text" id="last_owner" class="form-control" placeholder="Last Owner" value="<?= $row['Last_Owner']; ?>" name="lastowner">
</div>
<div class="col-sm-4">
<label>First Cond Type</label>
<input type="text" id="first_cond_type" class="form-control" placeholder="First Cond Type" value="<?= $row['First_Cond_Type']; ?>" name="firstcondtype">
</div>
<div class="col-sm-4">
<label>Last Cond Type</label>
<input type="text" id="last_cond_type" class="form-control" placeholder="Last Cond Type" value="<?= $row['Last_Cond_Type']; ?>" name="lastcondtype">
</div>
</div>
<div class="form-group">
<div class="col-sm-4">
<label>State</label>
<input type="text" id="state" class="form-control" placeholder="State" value="<?= $row['State']; ?>" name="st">
</div>
<div class="col-sm-4">
<label>Check Active</label>
<input type="text" id="check_active" class="form-control" placeholder="Check Active" value="<?= $row['Check_Active']; ?>" name="checkactive">
</div>
<div class="col-sm-4">
<label>Check Jepd</label>
<input type="text" name="check_jepd" id="check_jepd" class="form-control"placeholder="Check Jepd" value="<?= $row['Check_Jepd']; ?>" name="checkjepd">
</div>
</div>
<div class="form-group">
<div class="col-sm-4">
<label>CLLI</label>
<input type="text" id="clli" class="form-control" placeholder="CLLI" value="<?= $row['CLLI']; ?>" name="clli">
</div>
<div class="col-sm-4">
<label>Resolved Date</label>
<div class="input-group">
<span class="input-group-addon">
<i class="fa fa-calendar"></i>
</span>
<input type="date" id="resolved_date" class="form-control" placeholder="Resolved_Date" value="<?= $row['Resolved_Date']; ?>" name="resolved_date">
</div>
</div>
<div class="col-sm-4">
<label>Filtered Date</label>
<div class="input-group">
<span class="input-group-addon">
<i class="fa fa-calendar"></i>
</span>
<input type="date" id="filtered_date" class="form-control" placeholder="Filtered Date" value="<?= $row['Filtered_Date']; ?>" name="filtereddate">
</div>
</div>
</div>
<div class="form-group">
<div class="col-sm-4">
<label>Filtered By</label>
<input type="text" id="filtered_by" class="form-control" placeholder="Filtered by" value="<?= $row['Filtered_By']; ?>" name="filteredby">
</div>
<div class="col-sm-4">
<label>Restored Date</label>
<div class="input-group">
<span class="input-group-addon">
<i class="fa fa-calendar"></i>
</span>
<input type="date" id="restored_date" class="form-control" placeholder="Restored_Date" value="<?= $row['Restored_Date']; ?>" name="restoreddate">
</div>
</div>
</div>
<div class="form-group">
<div class="col-sm-4 ">
<label class="text-bold"> NMA Comments subform </label>
</div>
<div class="col-sm-4">
</div>
</div>
<hr>
<div class="form-group">
<?php
$io = mysqli_query($db,"select * from NMA_Comments where NMA_Tkt_Num='$row[NMA_Ticket_Number]'");
$tr=mysqli_fetch_assoc($io);
?>
<div class="col-sm-4">
<label>NMA Ticket Number</label>
<input type="text" name="NMA_Ticket_Number" id="nma_ticket_number" class="form-control" placeholder="NMA Ticket Number" value="<?php echo $tr['NMA_Tkt_Num']; ?>" >
</div>
<div class="col-sm-4">
<label>NMA Notes</label>
<textarea type="text" name="NMA_Notes" id="nma_notes" class="form-control" placeholder="NMA Notes"><?php echo $tr['NMA_Notes']; ?></textarea>
</div>
<div class="col-sm-4">
<label>NMA Note Date</label>
<input type="text" name="NMA_Ticket_Date" id="nma_ticket_number" class="form-control" placeholder="NMA Ticket Number" value="<?php echo $tr['NMA_Note_Date']; ?>">
</div>
</div>
<div class="form-group">
<div class="col-sm-4">
<button class="btn btn-primary" name="UPDATE_RAW"> Save and Close</button>
</div>
<div class="col-sm-4">
<button class="btn btn-success" name="MOVE_TO_RESOLVED"> Resolved and Close</button>
</div>
<div class="col-sm-4">
<button class="btn btn-danger" name="MOVE_TO_INHIBITS"> Inhibit and Close</button>
</div>
</div>
</form>
</div>
</div>
</div>
</section>
<?php
if(isset($_POST['UPDATE_RAW'])){
extract($_POST);
//print_r($_POST);
$sql=mysqli_query($db,"update nma_raw set NMA_System='$nmasystem',NMA_Ticket_Number='$nmaticketnum',Tkt_Priority='$tktpriority',Created_On_Worklist='$createdonworklist',Create_Date='$createdate',Create_Time='$createtime',Days_Old='$daysold',Interval_Onlist='$intervalonlist',Check_Status='$checkstatus',Ticket_Status='$ticketstatus',Relate_Status='$relatestatus',WFA_TR_Num='$wfatrnum',Recent_WFA_Dispatch_Status='$recentwfadispatchstatus',Last_Owner='$lastowner',Entity_Status='$entitystatus',Entity='$entity',First_Cond_Type='$firstcondtype',Last_Cond_Type='$lastcondtype',State='$st',CLLI='$clli',Check_Active='$checkactive',Check_Jepd='$checkjepd', Resolved_Date='$resolved_date' WHERE ID='$id'");
if($sql){
echo"<script>alert('Updated SuccessFully');window.location.href='Active_Tkt_Qry_List_Frm_NMA.php';</script>";
}
else{
echo"<script>alert('Some ERRORS');</script>";
}
}
?>
<?php
if(isset($_POST['MOVE_TO_INHIBITS'])){
extract($_POST);
//$print_r($_POSt);
$sql=mysqli_query($db,"INSERT INTO nma_main_table SELECT * FROM nma_raw where ID='$id'");
if($sql){
echo"<script>alert('Updated SuccessFully');window.location.href='Active_Tkt_Qry_List_Frm_NMA.php';</script>";
}
else{
echo"<script>alert('Some ERRORS');</script>";
}
// sql to delete a record
$sql=mysqli_query($db,"DELETE FROM nma_raw WHERE ID='$id'");
if ($sql){
echo "Record Inhibited successfully";
} else {
echo "<script>alert('Error in deletion');</script>";
}
}
?>
<?php
if(isset($_POST['MOVE_TO_RESOLVED'])){
extract($_POST);
//$print_r($_POSt);
$sql=mysqli_query($db,"INSERT INTO nma_main_table SELECT * FROM nma_raw where ID='$id'");
if($sql){
echo"<script>alert('Updated SuccessFully');window.location.href='Active_Tkt_Qry_List_Frm_NMA.php';</script>";
}
else{
echo"<script>alert('Some ERRORS');</script>";
}
// sql to delete a record
$sql=mysqli_query($db,"DELETE FROM nma_raw WHERE ID='$id'");
if ($sql){
echo "Record Resolved successfully";
} else {
echo "<script>alert('Error in deletion');</script>";
}
}
?>
<?php include_once "footer.php";?>
If the error you're getting is Incorrect date value: '' for column 15daytkt.nma_raw.Resolved_Date (as you've mentioned in the comments) :
It looks like you are passing an empty string to the Resolved_Date column, and it's invalid. Please make sure you're actually passing a valid date string in this format 2019-11-15. Usually, the HTML form inputs with the date type return this format.
You can verify this case by setting the value to NULL if it's empty. Try changing the query as below:
$sql = mysqli_query($db,"update nma_raw set NMA_System='$nmasystem', Resolved_Date=NULLIF($resolved_date, '') WHERE ID='$id'");
Note the NULLIF($resolved_date, '') part. It will basically set the value to null if it is empty.
Hope it helps.
I have a webpage in php which has some form data in sql the user can update the data.
The form is like below:
<?php
$id=$_GET['id'];
$SelSql = "SELECT * FROM `registers` WHERE id=$id";
$res = mysqli_query($link, $SelSql);
$r = mysqli_fetch_assoc($res);
?>
<?php if(isset($fmsg)){ ?><div class="alert alert-danger" role="alert"> <?php echo $fmsg; ?> </div><?php } ?>
<div class="breadcrumbs">
<div class="breadcrumbs-inner">
<div class="row m-0">
<div class="col-sm-4">
<div class="page-header float-left">
<div class="page-title">
<h1>Member Details</h1>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="content">
<div class="animated fadeIn">
<div class="row">
<div class="col-xs-6 col-sm-6">
<div class="card">
<div class="card-body card-block">
<div class="form-group">
<label class=" form-control-label">Member ID</label>
<div class="input-group">
<div class="input-group-addon"><i class="fa fa-id-card-o"></i></div>
<input class="form-control" value="<?php echo $r['id']; ?>" readonly>
</div>
</div>
<form method="post">
<div class="form-group">
<label class=" form-control-label">First Name</label>
<div class="input-group">
<div class="input-group-addon"><i class="fa fa-address-card-o"></i></div>
<input name="fname" class="form-control" value="<?php echo $r['firstname']; ?>">
</div>
</div>
<div class="form-group">
<label class=" form-control-label">Last Name</label>
<div class="input-group">
<div class="input-group-addon"><i class="fa fa-address-card-o"></i></div>
<input name="lname" class="form-control" value="<?php echo $r['lastname']; ?>">
</div>
</div>
<div class="form-group">
<label class=" form-control-label">Mobile Number</label>
<div class="input-group">
<div class="input-group-addon"><i class="fa fa-mobile"></i></div>
<input name="mobile" class="form-control" value="<?php echo $r['mobilenumber']; ?>">
</div>
</div>
<div class="form-group">
<label class=" form-control-label">Company</label>
<div class="input-group">
<div class="input-group-addon"><i class="fa fa-building"></i></div>
<input name="company" class="form-control" value="<?php echo $r['company']; ?>">
</div>
</div>
<div class="form-group">
<label class=" form-control-label">Designation</label>
<div class="input-group">
<div class="input-group-addon"><i class="fa fa-clipboard"></i></div>
<input name="designation" class="form-control" value="<?php echo $r['designation']; ?>">
</div>
</div>
<div class="form-group">
<label class=" form-control-label">Experience</label>
<div class="input-group">
<div class="input-group-addon"><i class="fa fa-sort-numeric-asc"></i></div>
<input name="experience" class="form-control" value="<?php echo $r['experience']; ?>">
</div>
</div>
<div class="form-group">
<label class=" form-control-label">Address</label>
<div class="input-group">
<div class="input-group-addon"><i class="fa fa-map-marker"></i></div>
<input name="address" class="form-control" value="<?php echo $r['address']; ?>">
</div>
</div>
<div class="form-group">
<label class=" form-control-label">Address Line 2</label>
<div class="input-group">
<div class="input-group-addon"><i class="fa fa-map-marker"></i></div>
<input name="addressline2" class="form-control" value="<?php echo $r['addressline2']; ?>">
</div>
</div>
<div class="form-group">
<label class=" form-control-label">City</label>
<div class="input-group">
<div class="input-group-addon"><i class="fa fa-building-o"></i></div>
<input name="city" class="form-control" value="<?php echo $r['city']; ?>">
</div>
</div>
<div class="form-group">
<label class=" form-control-label">State</label>
<div class="input-group">
<div class="input-group-addon"><i class="fa fa-map"></i></div>
<input name="state" class="form-control" value="<?php echo $r['state']; ?>">
</div>
</div>
<div class="form-group">
<label class=" form-control-label">Pin</label>
<div class="input-group">
<div class="input-group-addon"><i class="fa fa-map-pin"></i></div>
<input name="pin" class="form-control" value="<?php echo $r['pin']; ?>">
</div>
</div>
<div class="form-group">
<label class=" form-control-label">Country</label>
<div class="input-group">
<div class="input-group-addon"><i class="fa fa-globe"></i></div>
<input name="country" class="form-control" value="<?php echo $r['country']; ?>">
</div>
</div>
<div class="form-group">
<label class=" form-control-label">Whatsapp Number</label>
<div class="input-group">
<div class="input-group-addon"><i class="fa fa-phone-square"></i></div>
<input name="whatsapp" class="form-control" value="<?php echo $r['Whatsapp']; ?>">
</div>
</div>
</div>
</div>
</div>
<div class="col-xs-6 col-sm-6">
<div class="card">
<div class="card-body card-block">
<div class="form-group">
<label class=" form-control-label">Alternate Number</label>
<div class="input-group">
<div class="input-group-addon"><i class="fa fa-phone"></i></div>
<input name="alternate" class="form-control" value="<?php echo $r['alternatenumber']; ?>">
</div>
</div>
<div class="form-group">
<label class=" form-control-label">Email</label>
<div class="input-group">
<div class="input-group-addon"><i class="fa fa-envelope"></i></div>
<input name="email" class="form-control" value="<?php echo $r['Email']; ?>">
</div>
</div>
<div class="form-group">
<label class=" form-control-label">Company Registration Number</label>
<div class="input-group">
<div class="input-group-addon"><i class="fa fa-registered"></i></div>
<input name="crn" class="form-control" value="<?php echo $r['CompanyRegNumber']; ?>">
</div>
</div>
<div class="form-group">
<label class=" form-control-label">Date of Incorporation</label>
<div class="input-group">
<div class="input-group-addon"><i class="fa fa-calendar"></i></div>
<input name="doi" class="form-control" value="<?php echo $r['Date_Incorporation_orBusi_Stp']; ?>">
</div>
</div>
<div class="form-group">
<label class=" form-control-label">GST IN</label>
<div class="input-group">
<div class="input-group-addon"><i class="fa fa-sort-numeric-asc"></i></div>
<input name="gstin" class="form-control" value="<?php echo $r['GSTIN']; ?>">
</div>
</div>
<div class="form-group">
<label class=" form-control-label">Services Offered</label>
<div class="input-group">
<div class="input-group-addon"><i class="fa fa-question-circle"></i></div>
<input name="services" class="form-control" value="<?php echo $r['Services_Offered']; ?>">
</div>
</div>
<div class="form-group">
<label class=" form-control-label">Annual Turnover</label>
<div class="input-group">
<div class="input-group-addon"><i class="fa fa-money"></i></div>
<input name="annualt" class="form-control" value="<?php echo $r['Annual_Turnover']; ?>">
</div>
</div>
<div class="form-group">
<label class=" form-control-label">Fee</label>
<div class="input-group">
<div class="input-group-addon"><i class="fa fa-money"></i></div>
<input name="fee" class="form-control" value="<?php echo $r['Fee']; ?>">
</div>
</div>
<div class="form-group">
<label class=" form-control-label">Mode of Payment</label>
<div class="input-group">
<div class="input-group-addon"><i class="fa fa-credit-card"></i></div>
<input name="mop" class="form-control" value="<?php echo $r['Mode_of_Payment']; ?>">
</div>
</div>
<div class="form-group">
<label class=" form-control-label">Recommended By (A)</label>
<div class="input-group">
<div class="input-group-addon"><i class="fa fa-user"></i></div>
<input name="reca" class="form-control" value="<?php echo $r['Recommended_by_A']; ?>">
</div>
</div>
<div class="form-group">
<label class=" form-control-label">Recommended By (B)</label>
<div class="input-group">
<div class="input-group-addon"><i class="fa fa-user"></i></div>
<input name="recb" class="form-control" value="<?php echo $r['Recommended_by_B']; ?>">
</div>
</div>
<div class="form-group">
<label class=" form-control-label">Terms and Conditions</label>
<div class="input-group">
<div class="input-group-addon"><i class="fa fa-check"></i></div>
<input name="tac" class="form-control" value="<?php echo $r['termsandconditions']; ?>">
</div>
</div>
<div class="form-group">
<label class=" form-control-label">Declaration</label>
<div class="input-group">
<div class="input-group-addon"><i class="fa fa-check"></i></div>
<input name="dec" class="form-control" value="<?php echo $r['Declaration']; ?>">
</div>
</div>
<div class="form-group">
<label class=" form-control-label">Confirmation</label>
<div class="input-group">
<div class="input-group-addon"><i class="fa fa-check"></i></div>
<input name="cof" class="form-control" value="<?php echo $r['confirmation']; ?>">
</div>
</div>
<input type="submit" class="btn btn-primary" value="Update">
</form>
</div>
</div>
</div>
<?php
if(isset($_POST) & !empty($_POST)){
$fname = $_POST['fname'];
$lname = $_POST['lname'];
$email = $_POST['mobile'];
$company = $_POST['company'];
$designation = $_POST['designation'];
$experience = $_POST['experience'];
$address = $_POST['address'];
$addressline2 = $_POST['addressline2'];
$city = $_POST['city'];
$state = $_POST['state'];
$pin = $_POST['pin'];
$country = $_POST['country'];
$whatsapp = $_POST['whatsapp'];
$alternate = $_POST['alternate'];
$email = $_POST['email'];
$crn = $_POST['crn'];
$doi = $_POST['doi'];
$gstin = $_POST['gstin'];
$services = $_POST['services'];
$annualt = $_POST['annualt'];
$fee = $_POST['fee'];
$mop = $_POST['mop'];
$reca = $_POST['reca'];
$recb = $_POST['recb'];
$tac = $_POST['tac'];
$dec = $_POST['dec'];
$cof = $_POST['cof'];
}
$UpdateSql = "UPDATE `registers` SET firstname='$fname', lastname='$lname', mobilenumber='$email', experience='$experience',
designation='$designation', company='$company', address='$address', addressline2='$addressline2',
city='$city', state='$state', pin='$pin', country='$country',
Whatsapp='$whatsapp', alternatenumber='$alternate', Email='$email', CompanyRegNumber='$crn',
Date_Incorporation_orBusi_Stp='$doi', GSTIN='$gstin', Services_Offered='$services', Annual_Turnover='$annualt',
Declaration='$dec', Fee='$fee', confirmation='$cof', Mode_of_Payment='$mop',
Recommended_by_A='$reca', Recommended_by_B='$recb', termsandconditions='$tac' WHERE id=$id";
$res = mysqli_query($link, $UpdateSql);
if($res){
header('location: update.php');
}else{
$fmsg = "Failed to update data.";
}
?>
the update feature is working completely fine, when the user loads this page, the data is displayed in the form which is editable by user,now the problem is when the user updates the data, the page reloads and updates the data in database but, the page is displayed with empty values in the input fields, such that if the user clicks the update button again by mistake, the database field becomes blank. what is the problem in my code, what should i do to stop this mistake?
The issue is fundamentally how you are passing parameters. If you are POSTing then the parameter id will not be accessible with your current code, which expects id to be a GET parameter. Try this:
$id=$_POST['id'];
Or better yet,
$id=$_REQUEST['id'];
The $_REQUEST variable is an associative array that by default contains the contents of $_GET, $_POST and $_COOKIE. Since it seems that you need the id parameter for both GET and POST methods, $_REQUEST should be used here.
UPDATE
Your mysqli_query($link, $UpdateSql) function should be wrapped in the if(isset($_POST) & !empty($_POST)) condition. It looks like it is executing on each load the way the code currently is.
if(isset($_POST) & !empty($_POST)){
...
$UpdateSql = "....."
$res = mysqli_query($link, $UpdateSql);
}
Pass id, when you are redirecting page, on success as following
if($res){
header('location: update.php?id='.$id);
exit;
}else{
$fmsg = "Failed to update data.";
}
I tried to insert multiple rows in sql . But it inserts only the last one row and in that one row only storing first character of each column. I prints the query by echo, it shows only one last row, but gives all characters of each column. one more thing is iam inserting values in two tables by clicking on submit button. can anyone help on this.
Here it is the view :
<form class="" method="POST" enctype="multipart/form-data" action="<?php echo base_url(); ?>dashboard/addnewjobmela" >
<input type="hidden" name="csrfmiddlewaretoken" value="LgVIVf7yFe5bL9k2Rcj9TGLLpgKJX1LkmfiiptEZnN95y9WqKXHk7V4vGixmo6Wd">
<input type="hidden" id="cperson_no" value="1">
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-4 ">
<div class="form-group">
<label>Job Mela Title</label>
<input class="form-control" type="text" name="title" required="" id="title">
</div>
</div>
<div class="col-xs-12 col-sm-12 col-md-4">
<div class="form-group">
<label>Job Mela Date</label>
<input class="form-control" type="date" name="date" required="" id="date">
</div>
</div>
<div class="col-xs-12 col-sm-12 col-md-4">
<div class="form-group">
<label>Last Date To Register</label>
<input class="form-control" type="date" name="laastdatetoregister" required="" id="laastdatetoregister">
</div>
</div>
<div class="col-xs-12 col-sm-12 ">
<div class="form-group">
<label>Venue Details</label>
<textarea class="form-control" name="venuedetails" cols="40" rows="2" required="" id="venuedetails"></textarea>
</div>
</div>
<div class="col-xs-12 col-sm-12 col-md-4 ">
<div class="form-group">
<label>Contact Person</label>
<input class="form-control" type="text" name="contactperson" required="" id="contactperson">
</div>
</div>
<div class="col-xs-12 col-sm-12 col-md-4 ">
<div class="form-group">
<label>Contact Emailid</label>
<input class="form-control" type="text" name="emailid" required="" id="emailid">
</div>
</div>
<div class="col-xs-12 col-sm-12 col-md-4 ">
<div class="form-group">
<label>Contact Number</label>
<input class="form-control" type="text" name="contactnumber" required="" id="contactnumber">
</div>
</div>
</div>
<div class="row-fluid" >
<div style="background-color:#d6e9c6 !important;padding:10px"><p class="text-success"><b>Participating Companies</b></p></div>
</div>
<div class="col-xs-12 right" style="margin-top:-40px;margin-bottom: 20px">
<button class="btn btn-success" type="button" onclick="addingcompanies()">Add More</button>
</div>
<div id="companies">
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-4 ">
<div class="form-group">
<label>Company Name</label>
<input class="form-control" type="text" name="company" required="" id="company">
</div>
</div>
<div class="col-xs-12 col-sm-12 col-md-4 ">
<div class="form-group">
<label>Job Title</label>
<input class="form-control" type="text" name="jobtitle" required="" id="jobtitle">
</div>
</div>
<div class="col-xs-12 col-sm-12 col-md-4 ">
<div class="form-group">
<label>Required Qualification</label>
<?php
echo form_dropdown('qualification', $education,'' ,'required="" class="form-control"');
?>
</div>
</div>
<div class="col-xs-12 col-sm-12 col-md-4 ">
<div class="form-group">
<label>Specialization</label>
<input class="form-control" type="text" name="specialization" required="" id="specialization">
</div>
</div>
<div class="col-xs-12 col-sm-12 col-md-4 ">
<div class="form-group">
<label>Sector</label>
<input class="form-control" type="text" name="sector" required="" id="sector">
</div>
</div>
<div class="col-xs-12 col-sm-12 col-md-4">
<div class="form-group">
<label>Job Type</label>
<?php
echo form_dropdown('jobtype', $jobtype,'' ,'required="" class="form-control"');
?>
</div>
</div>
<!-- <div class="col-xs-12 col-sm-12 col-md-4">
<div class="form-group">
<label>Company Logo</label>
<input class="form-control" type="file" name="picture" accept=".jpeg,.JPEG,.JPG,.jpg,.png,.PNG" required="" id="id_picture">
</div>
</div> -->
<div class="col-xs-12 col-sm-12 col-md-4 ">
<div class="form-group">
<label>Job Location</label>
<input class="form-control" type="text" name="joblocation" required="" id="joblocation">
</div>
</div>
</div>
</div>
<div class="col-xs-12" style="text-align:center">
<button class="btn btn-success" type="submit" value="Save Profile">Submit</button>
</div>
</form>
Javascript/Jquery to add ADD More Fields
<script type="text/javascript">
function addingcompanies()
{
var cperson_no = $('#cperson_no').val();
var j=parseInt(cperson_no)+1;
$('#cperson_no').val(j);
var qualification = '<?php echo str_replace("'", '', preg_replace("/\r|\n/", "", form_dropdown('qualification', $education,'' ,'required="" class="form-control"'))); ?>';
var jobtype = '<?php echo str_replace("'", '', preg_replace("/\r|\n/", "", form_dropdown('jobtype', $jobtype,'' ,'required="" class="form-control"'))); ?>';
$('#companies').append('<div class="row group"><hr/><div class="col-xs-12 col-sm-12 col-md-4 "> <div class="form-group"> <label>Company Name</label> <input class="form-control" type="text" name="company" required="" id="company' + cperson_no + '"> </div></div><div class="col-xs-12 col-sm-12 col-md-4 "> <div class="form-group"> <label>Job Title</label> <input class="form-control" type="text" name="jobtitle" required="" id="jobtitle' + cperson_no + '"> </div></div><div class="col-xs-12 col-sm-12 col-md-4 "> <div class="form-group"> <label>Required Qualification</label> '+ qualification +'</div></div><div class="col-xs-12 col-sm-12 col-md-4 "> <div class="form-group"> <label>Specialization</label> <input class="form-control" type="text" name="specialization" required="" id="specialization' + cperson_no + '"> </div></div><div class="col-xs-12 col-sm-12 col-md-4 "> <div class="form-group"> <label>Sector</label> <input class="form-control" type="text" name="sector" required="" id="sector' + cperson_no + '"> </div></div><div class="col-xs-12 col-sm-12 col-md-4"> <div class="form-group"> <label>Job Type</label>'+jobtype+' </div></div><div class="col-xs-12 col-sm-12 col-md-4 "> <div class="form-group"> <label>Job Location</label> <input class="form-control" type="text" name="joblocation" required="" id="joblocation' + cperson_no + '"> </div></div><div class="col-xs-12 col-sm-4 col-md-4 "><button class="btn btn-danger" style="margin-top: 25px; !important;" type="button" onClick="con_grpremove(this)">Remove</button></div></div></div>');
}
function con_grpremove(obj) {
$(obj).closest(".group").remove();
}
</script>
Here it is the controller :
public function addnewjob()
{
$this->load->model('dashboard_model');
$result = $this->dashboard_model->addnewjob();
$this->session->msg = "New Job Added Successfully";
redirect('dashboard');
}
public function addnewjobmela()
{
$this->load->model('dashboard_model');
$result = $this->dashboard_model->addnewjobmela();
$this->session->msg = "New Job Mela Added Successfully";
redirect('dashboard');
}
Model :
public function addnewjobmela() {
$data['title'] = $this->input->post('title');
$data['date'] = $this->input->post('date');
$data['lastdate'] = $this->input->post('laastdatetoregister');
$data['venue'] = $this->input->post('venuedetails');
$data['contactperson'] = $this->input->post('contactperson');
$data['emailid'] = $this->input->post('emailid');
$data['contactnumber'] = $this->input->post('contactnumber');
$data['status'] = 1;
$data['id'] = $this->db->insert_id();
print_r($data);
$this->db->insert('jobmelas', $data);
$jobmelaid = $this->db->insert_id();
$jcdata['company'] = $this->input->post('company');
$jcdata['jobtitle'] = $this->input->post('jobtitle');
$jcdata['qualification'] = $this->input->post('qualification');
$jcdata['specialization'] = $this->input->post('specialization');
$jcdata['sector'] = $this->input->post('sector');
$jcdata['jobtype'] = $this->input->post('jobtype');
$this->insCompanies($jobmelaid, $jcdata);
}
public function insCompanies($jobmelaid, $jcdata, $update='') {
if($update == 'update'){
$this->db->query('delete from job_mela_companies where jobmelaid = '.$jobmelaid.'');
}
print_r($jcdata);
for ($i = 0; $i < count($jcdata['company']); $i++) {
$cp_data[] = array(
'jobmelaid' => $jobmelaid,
'company' => $jcdata['company'][$i],
'jobtitle' => $jcdata['jobtitle'][$i],
'qualification' => $jcdata['qualification'][$i],
'specialization' => $jcdata['specialization'][$i],
'jobtype' => $jcdata['jobtype'][$i],
'sector' => $jcdata['sector'][$i]
);
$this->db->insert('job_mela_companies', $cp_data);
}
}
First table is giving result correct but
The output of more fields giving like this:
try below array and remove $cp_data[] = array(....) from insCompanies function.
$cp_data = array(
'jobmelaid' => $jobmelaid,
'company' => $jcdata['company'][$i],
'jobtitle' => $jcdata['jobtitle'][$i],
'qualification' => $jcdata['qualification'][$i],
'specialization' => $jcdata['specialization'][$i],
'jobtype' => $jcdata['jobtype'][$i],
'sector' => $jcdata['sector'][$i]
);
I succesfully managed to add to my url an parameter but I can't increment it. For example, if I click on the submit button the url should transform from http://localhost/code/1 to http://localhost/code/2 . I have made an input hidden to access the url but I can't redirect it to the desired value, how can I do this? This is my PHP code:
<?php
$cod=strtoupper($_GET['params']);
$i=$_GET['params1'];
$id_rezervare="SELECT id FROM trezervare WHERE numar_rezervare = '$cod'";
$id_rezervare = $db->DbGetOne($id_rezervare);
$cod_rezervare="SELECT UPPER(numar_rezervare) FROM trezervare WHERE numar_rezervare = '$cod'";
$cod_rezervare = $db->DbGetOne($cod_rezervare);
$cod_rezervare1 = strtoupper($cod_rezervare);
$nr_camere="SELECT count(*) FROM trezervarecont WHERE idrezervare= $id_rezervare ";
$nr_camere = $db->DbGetOne($nr_camere);
$checkin_status=TRUE;
$actual_link = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
$data_nasterii= $_GET['datanasterii'];
$test_arr = explode('/', $data_nasterii);
if(isset($_POST['trimite'])){
if (count($test_arr) == 3) {
if (checkdate($test_arr[0], $test_arr[1], $test_arr[2])) {
} else {
$message = "Date has an invalid format";
echo "<script type='text/javascript'>alert('$message');</script>";
}
} else {
$message = "No date selected";
echo "<script type='text/javascript'>alert('$message');</script>";
}
}
if(isset($_POST['trimite'])){
$i++;
}
?>
<div class="animated fadeOutZoom">
<div class="container container-sm animated fadeInDown">
<div class="center-block mt-xl">
<div class="panel">
<div class="panel-body">
<p class="pv text-bold">Check-in for room number <?php echo $i; ?></p>
<form action="" method="post">
<div class="row">
<div class="col-md-12 form-group">
<label for="nume">Nume</label>
<input type="text" id="text " class="form-control " name="nume" >
</div>
<input type="hidden" id="custId" name="checkin_status" value="<?php echo 1;?>">
<input type="text" id="custId" name="checkin_status" value="<?php echo $actual_link;?>">
<div class="col-md-12 form-group">
<label for="nume">Data Nasterii</label>
<input type="text" class="form-control" id="arrival_date" name="datanasterii"required/>
</div>
<div class="col-md-12 form-group">
<label for="nume">Locul nasterii</label>
<input type="text" id="text "class="form-control " name="loculnasterii" required>
</div>
<div class="col-md-12 form-group">
<label for="nume">Cetatenia</label>
<input type="text" id="text "class="form-control " name="cetatenie" required>
</div>
<div class="col-md-12 form-group">
<label for="nume">Localitate</label>
<input type="text" id="text "class="form-control " name="localitate" required>
</div>
<div class="col-md-12 form-group">
<label for="nume">Strada</label>
<input type="text" id="text "class="form-control " name="strada" required>
</div>
<div class="col-md-12 form-group">
<label for="nume">Numar strada</label>
<input type="text" id="text "class="form-control " name="nrstrada" required>
</div>
<div class="col-md-12 form-group">
<label for="nume">Tara</label>
<input type="text" id="text "class="form-control " name="tara" required>
</div>
<div class="col-md-12 form-group">
<label for="nume">Tip act</label>
<input type="text" id="text "class="form-control " name="tipact" required>
</div>
<div class="col-md-12 form-group">
<label for="nume">Serie act</label>
<input type="text" id="text "class="form-control " name="serieact" required>
</div>
<div class="col-md-12 form-group">
<label for="nume">Numar act</label>
<input type="text" id="text "class="form-control " name="nract" required>
</div>
</div>
<div class="row">
<div class="col-md-12 form-group">
<label for="telefon">Telefon</label>
<input type="phone" id="telefon " class="form-control " name="telefon" required>
</div>
</div>
<div class="row">
<div class="col-md-12 form-group">
<label for="email">Email</label>
<input type="email" id="email" class="form-control" name="email" required >
</div>
</div>
<div class="row">
<div class="col-md-6 form-group">
<?php if($i==$nr_camere) echo'
<input type="submit" value="Finalizeaza rezervarea" class="btn btn-primary" name="trimite">';
elseif ($i>$nr_camere) {
header("location:../finalizeaza.php");
}
else echo ' <input type="submit" value="Continua rezervarea" class="btn btn-primary" name="trimite">';
?>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.8.0/js/bootstrap-datepicker.min.js"></script>
<script>
//$('#arrival_date, #departure_date').datepicker({format: 'yyyy/mm/dd'});
$('#arrival_date, #departure_date').datepicker({
format: 'yyyy-mm-dd',
endDate: '+0d',
minDate: '-120Y',
autoclose: true
});
</script>
I created a search page with jquery that will display result on same page and I succeed of doing it but the jquery that I made can only show data with index 0 and it will fail if I searched other data with differenct index. I am having Uncaught TypeError: Cannot read property 'StudentNumber' of undefined error in console log.How can I search json object with data matching what is type in the search bar then populate the textbox from db. Please help.... thanks....
$('#btnSearch').click(function(){
var txtValue = $("#txtsearch").val();
$.ajax({
type:"POST",
url:"<?php echo site_url('enrollment/studSearch');?>",
data: {q:txtValue},
dataType: "json",
success: function(data){
//console.log(data.studinfo[0].StudentNumber);
$("#studentnum").val(data.studinfo[0].StudentNumber);
$("#yearLevel").val(data.studinfo[0].YearLevel);
$("#lastname").val(data.studinfo[0].LastName);
$("#firstname").val(data.studinfo[0].FirstName);
$("#middlename").val(data.studinfo[0].MiddleName);
$("#txtTuition").val(data.studinfo[0].TuitionFee);
$("#txtMisc").val(data.studinfo[0].MiscFee);
$("#txtAddFee").val(data.studinfo[0].AdditionalFee);
$("#txtTotal").val(data.studinfo[0].Total);
$("#modeofpayment").val(data.studinfo[0].ModeOfPayment);
$("#payAmount").val(data.studinfo[0].PayableAmount);
},
});
});
my controller:
public function studSearch()
{
$str = $this->input->post('q');
$data['studinfo'] = $this->emodel->search_Student($str);
echo json_encode($data);
}
and the model:
function search_Student($str)
{
$this->db->select('*');
$this->db->from('studentinfo a');
$this->db->join('studFinance b','a.StudentNumber = b.StudentNumber');
$this->db->like('a.StudentNumber',$str);
$this->db->or_like('a.LastName',$str);
$this->db->or_like('a.FirstName',$str);
$query = $this->db->get();
$result = $query->result_array();
return $result;
}
this is the view:
<div id="page-wrapper">
<div id="page-inner">
<div class="row">
<div class="col-lg-12">
<h2>Billing Page</h2>
</div>
</div>
<hr />
<div class="row">
<div class="col-lg-12">
<?php
$attributes = array("class"=>"form- horizontal","id"=>"billform","name"=>"billform",
"autocomplete"=>"off");
echo form_open("enrollment/ebilling",$attributes);
?>
<div class="panel panel-primary">
<div class="panel-heading">
Personal Information
</div>
<div class="panel-body">
<div class="form-group col-lg-12">
<label class="control-label col-xs-2">Search:</label>
<div class="col-xs-3">
<input type="text" id="txtsearch" name="txtsearch" class="form-control"/>
</div>
<button type="button" class="btn btn-success" id="btnSearch" name="btnSearch">Search</button>
</div>
<div class="form-group col-lg-12">
<hr />
<label class="control-label col-xs-2">Student Number:</label>
<div class="col-xs-3">
<input type="text" readonly id="studentnum" name="studentnum" value="<?php echo set_value('studentnum');?>" class="form-control"/>
</div>
</div>
<div class="form-group col-lg-12">
<label class="control-label col-xs-2">Year Level:</label>
<div class="col-xs-3">
<input type="text" readonly id="yearLevel" name="yearLevel" value="<?php echo set_value('yearLevel');?>" class="form-control"/>
</div>
<label class="control-label col-xs-2">Last Name:</label>
<div class="col-xs-3">
<input type="text" id="lastname" name="lastname" value="<?php echo set_value('lastname');?>" readonly class="form-control" />
</div>
</div>
<div class="form-group col-lg-12">
<label class="control-label col-xs-2">First Name:</label>
<div class="col-xs-3">
<input type="text" id="firstname" name="firstname" value="<?php echo set_value('firstname');?>" readonly class="form-control" />
</div>
<label class="control-label col-xs-2">Middle Name:</label>
<div class="col-xs-3">
<input type=-"text" id="middlename" name="middlename" value="<?php echo set_value('middlename');?>" readonly class="form-control" />
</div>
</div>
</div>
</div>
<!-- END OF FIRST PANEL -->
<div class="panel panel-primary">
<div class="panel-heading">
Billing Mode
</div>
<div class="panel-body">
<div class="col-lg-6">
<div class="panel panel-info">
<div class="panel-heading">
Student Account
</div>
<div class="panel-body">
<div class="form-group col-lg-12">
<label class="control-label col-xs-5">Tuition Fee:</label>
<div class="col-xs-7">
<input type="text" id="txtTuition" readonly name="txtTuition" value=" <?php echo set_value('txtTuition');?>" class="form-control"/>
</div>
</div>
<div class="form-group col-lg-12">
<label class="control-label col-xs-5">Miscellaneous Fee:</label>
<div class="col-xs-7">
<input type="text" id="txtMisc" readonly name="txtMisc" value="<?php echo set_value('txtMisc');?>" class="form-control"/>
</div>
</div>
<div class="form-group col-lg-12">
<label class="control-label col-xs-5">Additional Fee:</label>
<div class="col-xs-7">
<input type="text" id="txtAddFee" readonly name="txtAddFee" value="<?php echo set_value('txtAddFee');?>" class="form-control"/>
</div>
</div>
<div class="form-group col-lg-12">
<label class="control-label col-xs-5">Total:</label>
<div class="col-xs-7">
<input type="text" id="txtTotal" readonly name="txtTotal" value="<?php echo set_value('txtTotal');?>" class="form-control"/>
</div>
</div>
</div>
</div>
<!-- END OF FIRST INSIDE PANEL -->
<div class="panel panel-info">
<div class="panel-heading">
Payment
</div>
<div class="panel-body">
<div class="form-group col-lg-12">
<label class="control-label col-xs-5">Mode of Payment:</label>
<div class="col-xs-7">
<input type="text" id="modeofpayment" name="modeofpayment" value="<?php echo set_value('modeofpayment');?>" readonly class="form-control"/>
</div>
</div>
<div class="form-group col-lg-12">
<label class="control-label col-xs-5">Payable Amount:</label>
<div class="col-xs-7">
<input type="text" id="payAmount" name="payAmount" value="<?php echo set_value('payAmount');?>" readonly class="form-control"/>
</div>
</div>
<div class="form-group col-lg-12">
<label class="control-label col-xs-5">Date:</label>
<div class="col-xs-7">
<input type="date" id="pDate" name="pDate" value="<?php echo set_value('pDate');?>" class="form-control"/>
<span class="text-danger"><?php echo form_error('pDate');?></span>
</div>
</div>
<div class="form-group col-lg-12">
<label class="control-label col-xs-5">OR Number:</label>
<div class="col-xs-7">
<input type="text" id="orNum" name="orNum" value="<?php echo set_value('orNum');?>" class="form-control"/>
<span class="text-danger"><?php echo form_error('orNum');?></span>
<input type="hidden" id="balance" name="balance"/>
</div>
</div>
<!-- END OF SECOND INSIDE PANEL -->
</div>
</div>
</div>
<div class="col-lg-6">
<table id="billTable" class="table table-hover table-bordered table-striped">
<thead>
<tr>
<th>OR Number</th>
<th>Amount</th>
<th>Date</th>
</tr>
</thead>
<tbody>
</tbody>
<tfoot>
<td>Balance</td>
</tfoot>
</table>
</div>
<!-- END OF TABLE -->
<div class="col-lg-6">
<div class="form-group col-lg-12">
<input type="button" class="btn btn-success" id="btnAddPayment" name="btnAddPayment"
value="Add Payment"/>
<button type="reset" class="btn btn-danger" id="btnReset" name="reset">Reset</button>
</div>
</div>
</div>
</div>
<?php echo form_close();
echo $this->session->flashdata('msg');?>
</div>
</div>
</div>
</div>