Postingan lainnya
Kelas Premium!
Belajar Javascript untuk website
Gunakan kupon "mulaijs" untuk diskon 75 ribu!
memasukkan value javascript ke database
Mau tanya bro & sist, aku kog kesulitan memasukkan value dari javascript pake codeigniter, bantuannya dong hhe
controller :
function create_data(){
$this->load->helper('form');
$data = array(
'presensi_karyawan_id' => $this->session->userdata('id'),
'presensi_date' => $this->input->post('tanggal_hadir'),
'presensi_type' => $this->input->post('type')
);
$this->mdl_karyawan->input_data($data,'presensi');
redirect('karyawan/');
}
view
<section>
<div class="row">
<div class="col-lg-6">
<!-- Form Absensi -->
<header class="panel-heading">
Form Absensi
</header>
<div class="panel-body">
<div class="form">
<form class="form-validate form-horizontal" id="feedback_form" method="POST" action="<?= base_url() ?>index.php/karyawan/create_data/">
<div class="form-group ">
<label for="absen" class="control-label col-lg-2">Tanggal <span class="required">*</span></label>
<div class="col-lg-10">
<input class="form-control " id="absen" type="datetime" name="tanggal_hadir" readonly />
</div>
</div>
<div class="form-group ">
<label for="ctype" class="control-label col-lg-2">Ket <span class="required">*</label>
<div id="ctype" class="col-lg-10">
<select class="form-control m-bot15" name="type">
<option value="in">In</option>
<option value="out">Out</option>
</select>
</div>
</div>
<div class="form-group">
<div class="col-lg-offset-2 col-lg-10">
<button class="btn btn-primary btn-block" type="submit">Submit</button>
</div>
</div>
</form>
</div>
</div>
</div>
<div class="col-lg-6">
<header class="panel-heading">
Finish Task
</header>
loading
</div>
</div>
</section>
<script type="text/javascript">
function showTime() {
var a_p = "";
var today = new Date();
var curr_hour = today.getHours();
var curr_minute = today.getMinutes();
var curr_second = today.getSeconds();
var months = ['Januari', 'Februari', 'Maret', 'April', 'Mei', 'Juni', 'Juli', 'Agustus', 'September', 'Oktober', 'November', 'Desember'];
var myDays = ['Minggu', 'Senin', 'Selasa', 'Rabu', 'Kamis', 'Jum'at', 'Sabtu'];
var date = new Date();
var day = date.getDate();
var month = date.getMonth();
var thisDay = date.getDay(),
thisDay = myDays[thisDay];
var yy = date.getYear();
var year = (yy < 1000) ? yy + 1900 : yy;
document.getElementById('absen').value=day + ' ' + months[month] + ' ' + year + ' ' + curr_hour + ":" + curr_minute + ":" + curr_second + " " + a_p;
}
function checkTime(i) {
if (i < 10) {
i = "0" + i;
}
return i;
}
setInterval(showTime, 500);
</script>
0
1 Jawaban:
value yg mau di isi ini ya gan?
<input class="form-control " id="absen" type="datetime" name="tanggal_hadir" readonly />
0