Selasa, 15 Januari 2013

Program Sederhana PHP DATA PASIEN

Program Sederhana PHP Program



















nama form = in_pasien.php

<body bgcolor="orange">
<form action="si_pasien.php" method="POST">
<table bordercolor="white" colspan=2 align=center border=4>
<tr>
<td colspan=3 align="center"><marquee><b>FORM INPUT DATA PASIEN</b></marquee></td>
</tr>
<tr>
<td align="center"><b>NOMOR PASIEN</b></td>
<td><input type="text" name="no"></td>
</tr>
<tr>
<td align="center"><b>NAMA PASIEN</b></td>
<td><input type="text" name="nama"></td>
</tr>
<tr>
<td align="center"><b>UMUR PASIEN</b></td>
<td><input type="text" name="umur"></td>
</tr>
<tr>
<td align="center"><b>JENIS KELAMIN</b></td>
<td><select name="kelamin"><option selected>-- p!L!h --</option>
                         <option value="L">L</option>
                         <option value="P">P</option></select></td>
</tr>
<tr>
<td align="center"><b>ALAMAT</b></td>
<td><textarea name="alamat" rows=5 cols=40></textarea></td>
</tr>
<tr>
<td align="center"><b>TELEPON</b></td>
<td><input type="text" name="telp"></td>
</tr>
<tr>
<td colspan=2 align="center"><input type="submit" value="Simpan"> <input type="reset" value="Batal"></td>
</tr>
</table>
</form>
<b><u><marquee>Created by: Sanusi</marquee></u></b>
</body>

nama form= koneksi_pasien.php

<body>
<?php
$koneksi=mysql_connect("localhost","root","")or die("Database gagal terkoneksi");
$db=mysql_select_db("medik_12104286")or die("database gagal ditemukan");
?>
</body>

nama form= si_pasien.php

<body>
<?php
include"koneksi_pasien.php";
$no_pasien=$_POST['no'];
$nm_pasien=$_POST['nama'];
$umur_pasien=$_POST['umur'];
$kel_pasien=$_POST['kelamin'];
$alm_pasien=$_POST['alamat'];
$telp_pasien=$_POST['telp'];

$simpan="INSERT INTO pasien VALUES('$no_pasien','$nm_pasien','$umur_pasien','$kel_pasien','$alm_pasien','$telp_pasien')";
$cek=mysql_query($simpan)or die(mysql_error());
include "tam_pasein.php";
?>
</body>

nama form= tam_pasien.php

<body>
<h1>DATA PASIEN</h1>
<?php
include "koneksi_pasien.php";
$tampil="select*from pasien";
$cek=mysql_query($tampil)or die(mysql_error());

while ($data=mysql_fetch_array($cek))
{
    ?>
    <pre>
    <?php echo"No Pasien         : ";echo $data['no_pasien'];?><br>
    <?php echo"Nama Pasien       : ";echo $data['nm_pasien'];?><br>
    <?php echo"Umur              : ";echo $data['umur_pasien'];?><br>
    <?php echo"Gender            : ";echo $data['kel_pasien'];?><br>
    <?php echo"Alamat            : ";echo $data['alm_pasien'];?><br>
    <?php echo"Telpon            : ";echo $data['telp_pasien'];?><br>
    ==================================================================
<b><u><marquee>Created by: Sanusi</marquee></u></b>   
</pre>
    <?php
}
?>
<a href="in_pasien.php">Input Data Pasien</a>
</body>



created by:  Sanusi

3 komentar: