Repository navigation
Expand file tree
/
Copy pathinputobat.php
More file actions
93 lines (89 loc) · 3.14 KB
/
Copy pathinputobat.php
File metadata and controls
93 lines (89 loc) · 3.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<? session_start(); ?>
<script type="text/javascript">
<!--
function MM_validateForm() { //v4.0
if (document.getElementById){
var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=document.getElementById(args[i]);
if (val) { nm=val.name; if ((val=val.value)!="") {
if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
} else if (test!='R') { num = parseFloat(val);
if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
min=test.substring(8,p); max=test.substring(p+1);
if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
} } } else if (test.charAt(0) == 'R') errors += '- '+nm+'.\n'; }
} if (errors) alert('Tidak boleh ada yang kosong\n');
document.MM_returnValue = (errors == '');
} }
//-->
</script>
<script>
function checkForInt(evt) {
var charCode = ( evt.which ) ? evt.which : event.keyCode;
return ( charCode >= 48 && charCode <= 57 || charCode == 8 );
}
</script>
<?
function rupiah($nominal)
{
$rupiah = number_format($nominal,0, ",",".");
$rupiah = "Rp " . $rupiah . ",-";
return $rupiah;
}
?>
<div class="news_block">
<style>
.up{ margin:auto; width:350px; text-align:center; margin-bottom:20px; border:#999999 solid 1px;background-color:#666; }
.up a{ background-color:#666; color:#FFFFFF; }
.up a:hover{ background-color:#fff; color:#000;}
</style>
<? include"waktu.php";?>
<form method="post" action="aksi_obat.php" onsubmit="MM_validateForm('kdobat','','R','nama','','R','jenis','','R','stok','','R');return document.MM_returnValue">
<table align="center" width="400" height="200" border="0" cellspacing="2" cellpadding="4" style="font-family:arial; font-size:12px; font-weight:bold; color:#666; margin:auto;">
<tr>
<td colspan="3" style="font-size:14px; padding-top:0px;" align="center" height="30" valign="top"> Form Input Obat </td>
</tr>
<tr>
<td>Kode Obat</td>
<td>:</td>
<td><input name="kdobat" type="text" id="kdobat" size="10" maxlength="10" />
</td>
</tr> <tr>
<td>Nama Obat</td>
<td>:</td>
<td><input name="nama" type="text" id="nama" size="20" />
</td>
</tr>
<tr>
<td>Jenis</td>
<td>:</td>
<td><select name="jenis" id="jenis">
<?
include"conn.php";
$p = mysql_query("select * from jenis order by id_jenis");
while($t=mysql_fetch_array($p)){ ?>
<option value="<?=$t[id_jenis]?>"><?=$t[nama_jenis]?></option>
<? } ?>
</select> </td>
</tr>
<tr>
<td>Stok</td>
<td>:</td>
<td><input name="stok" type="text" id="stok" size="10" onkeypress="return checkForInt(event)" />
</td>
</tr>
<tr>
<td>Kadaluarsa</td>
<td>:</td>
<td><script>DateInput('today', true)</script>
</td>
</tr>
<tr>
<td> </td>
<td> </td>
<td><input type="submit" name="tambah" value="submit" style="font-family:arial; font-size:12px; background:#FFFFFF; border:1px groove #999"/></td>
</tr>
</table></form>
</div>