* view-form-nilaimhs.php
<!DOCTYPE html>
<html>
<head>
<title>Form Nilai Mahasiswa</title>
</head>
<body>
<center>
<form action="<?= base_url('Nilaimahasiswa/cetak'); ?>" method="post">
<table>
<tr>
<th colspan="3">
Form Nilai Mahasiswa
</th>
</tr>
<tr>
<td colspan="3">
<hr>
</td>
</tr>
<tr>
<th>Nama Mahasiswa</th>
<th>:</th>
<td>
<input type="text" name="namamhs" id="namamhs">
</td>
</tr>
<tr>
<th>NIM Mahasiswa</th>
<td>:</td>
<td>
<input type="text" name="nimmhs" id="nimmhs">
</td>
</tr>
<tr>
<th>Nilai Absen</th>
<td>:</td>
<td>
<input type="text" name="nilaiabs" id="nilaiabs">
</td>
</tr>
<tr>
<th>Nilai Tugas</th>
<td>:</td>
<td>
<input type="text" name="nilaitugas" id="nilaitugas">
</td>
</tr>
<tr>
<th>Nilai UTS</th>
<td>:</td>
<td>
<input type="text" name="nilaiuts" id="nilaiuts">
</td>
</tr>
<tr>
<th>Nilai UAS</th>
<td>:</td>
<td>
<input type="text" name="nilaiuas" id="nilaiuas">
</td>
</tr>
<tr>
<td colspan="3" align="center">
<input type="submit" value="submit">
</td>
</tr>
</table>
</form>
</center>
</body>
</html>
kemudian kita buat view-data-nilaimhs. tampilan ini digunakan sebagai output dari codingan yang kita input tadi okay .
* View-data-nilaimhs.php
<!DOCTYPE html>
<html>
<head>
<title>Tampil Nilai Mahasiswa</title>
</head>
<body>
<center>
<table>
<tr>
<th colspan="3">
Tampilkan Data Nilai Mahasiswa
</th>
</tr>
<tr>
<td colspan="3">
<hr>
</td>
</tr>
<tr>
<th>Nama Mahasiswa </th>
<th>:</th>
<td>
<?= $namamhs;?>
</td>
</tr>
<tr>
<th>NIM Mahasiswa </th>
<th>:</th>
<td>
<?= $nimmhs;?>
</td>
</tr>
<tr>
<th>Nilai Absen </th>
<th>:</th>
<td>
<?= $nilaiabs;?>
</td>
</tr>
<tr>
<th>Nilai Tugas </th>
<th>:</th>
<td>
<?= $nilaitugas;?>
</td>
</tr>
<tr>
<th>Nilai UTS </th>
<th>:</th>
<td>
<?= $nilaiuts;?>
</td>
</tr>
<tr>
<th>Nilai UAS </th>
<td>:</td>
<td>
<?= $nilaiuas;?>
</td>
</tr>
<tr>
<th>Total Nilai </th>
<td>:</td>
<td>
<?= $nilaiabs *0.2 + $nilaitugas*0.25 +$nilaiuts*0.25+$nilaiuas*0.3;?>
</td>
</tr>
<tr>
<td colspan="3" align="center">
<a href="<?= base_url('Nilaimahasiswa'); ?>"> kembali</a>
</td>
</tr>
</table>
</center>
</body>
</html>
kemudian kita buat CInya dalam folder contoller .
* Nilaimahasiswa.php
class Nilaimahasiswa extends CI_Controller
{
public function index()
{
$this->load->view('view-form-nilaimhs.php');
}
public function cetak()
{
$data=[
'namamhs'=>$this->input->post('namamhs'),
'nimmhs'=>$this->input->post('nimmhs'),
'nilaiabs'=>$this->input->post('nilaiabs'),
'nilaitugas'=>$this->input->post('nilaitugas'),
'nilaiuts'=>$this->input->post('nilaiuts'),
'nilaiuas'=>$this->input->post('nilaiuas')];
$this->load->view('view-data-nilaimhs',$data);
}
}
oke done nanti codingan diatas akan menampilkan seperti gambar dibawah ini : enjoy semangat
No comments:
Post a Comment