Pemrograman Web 2. Modul 4. Form Matakuliah dengan menggunakan PHP + MYSql

1. File Formmtk.html


<html>
<body>
<h3> Form Input Matakuliah </h3>
<form method=post action=inputmtk.php>
<table border =1>
<tr><td>Kode Matakuliah :</td>
<td><input type=text name="kodemk"></td></tr>
<tr><td>Nama Matakuliah :</td>
<td><input type=text name="nmmk"></td></tr>
<tr><td>SKS             :</td>
<td><input type=text name="sks"></td></tr>
<tr><td>Semester        :</td>
<td><input type=text name="semester"></td></tr>
<tr><td>
<input type = submit value="Kirim">
<input type = reset value ="Cancel">
</td></tr>
</form>
</body>
</html>

 

2.  File InputMtk.php


<?php
include "konek.php";
$kodemtk  = $_POST['kodemtk'];
$nmmtk    = $_POST['nmmtk'];
$sks      = $_POST['sks'];
$semester = $_POST['semester'];
$input ="insert into mtk (kodemtk,nmmtk,sks)
 values('$kodemtk','$nmmtk','$sks')";
mysql_query($input);
if($input)
{header("location:tampilmtk.php");}
else
{echo"Input Gagal";}
?>

 

3.  File Tampilmtk.php


<?php
include "konek.php";
$tampil="select * from mtk";
$hasil = mysql_query($tampil);
echo"Daftar Matakuliah";
echo"<table border=1>";
echo"<tr><th>No.</th>
 <th>Kode MK</th>
 <th>Nama MK </th>
 <th>SKS </th>
 <th>Semester</th><tr>";
$nomor=1;
while ($data=mysql_fetch_row($hasil))
{
echo"<tr><td>$nomor</td>";
echo"<td>$data[0]</td>";
echo"<td>$data[1]</td>";
echo"<td>$data[2]</td>";
echo"<td>$data[3]</td></tr>";
$nomor++;
}
echo"</table>";
?>

Materi yang berhubungan :

1. Aplikasi Sistem Informasi Akademik
2. Form MAhasiswa
3. Form Dosen
4. Form Matakuliah
5. Jadwal Perkuliahan"
6. Form KRS
7. Form Nilai
8. Form LHS

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: