Hy Guys , Can anybody help me ?
I try to make small web database in my unit.
Some of fields have on change behaviour to get other data that automatically filled other text field. But when i try to hit "enter" after i fill text field , its automatically save data in my table database . I just want to save data after , i click "save" button.
[PHP]<?php
include"session .php";
mb_http_input(" iso-8859-1");
mb_http_output( "iso-8859-1");
$tgl=$_POST["tgl"];
$bln=$_POST["bulan"];
$thn=$_POST["tahun"];
$hari=mktime(0, 0,0,$bln,$tgl,$ thn);
$harike=date("N ",$hari);
$angkabln=date( "m",$hari);
$namabln=date(" F",$hari);
$namathn=date(" Y",$hari);
$tanggal=date(" d",$hari);
$year=date("Ymd ",$hari);
$fltdep=$_POST["fltdep"];
$reg=$_POST["reg"];
$save=$_POST["save"];
$categori=$_POS T["categori"];
$std=$_POST["std"];
$gate=$_POST["gate"];
$bay=$_POST["bay"];
$configc=$_POST["configc"];
$configy=$_POST["configy"];
$atd=$_POST["atd"];
$dl01=$_POST["dl01"];
$dl02=$_POST["dl02"];
$jam01=$_POST["jam01"];
$min01=$_POST["min01"];
$dur1=mktime($j am01,$min01,0,0 ,0,0);
$dur01=date("H: i",$dur1);
$jam02=$_POST["jam02"];
$min02=$_POST["min02"];
$dur2=mktime($j am02,$min02,0,0 ,0,0);
$dur02=date("H: i",$dur2);
$ttljam=$jam01+ $jam02;
$ttlmin=$min01+ $min02;
$ttl=mktime($tt ljam,$ttlmin,0, 0,0,0);
$ttldur=date("H :i",$ttl);
$btnsave=$_POST["save"];
//cek registrasi//
include("../koneksi.php");
$cek_reg=mysql_ query("select *from tblacft where registrasi='$re g'",$koneksi) or die(mysql_error ());
$dpt_reg=mysql_ fetch_array($ce k_reg);
//cek skedule//
$cek_std=mysql_ query("select * from tblskeddep where day='$harike' and fltnbr='$fltdep '",$koneksi)
or die(mysql_error ());
$row_std=mysql_ fetch_array($ce k_std);
//input data//
if(isset($act)) {
$tambah="INSERT INTO tbldataflt(airl inekode,day,tgl ,bulan,tahun,fl tdep,reg,type,g ate,bay,categor i,configc,confi gy,ahan,pax,otp ,
std,atd,del01,d el02,dur01,dur0 2,ttldur) VALUES('$kode', '$harike','$yea r','$namabln',' $namathn','$flt dep','$reg','$d pt_reg[type]','$gate','$bay ','$categori1',
'$dpt_reg[configc]','$dpt_reg[configy]','$ahan1','$pa x1','$otp1','$r ow_std[std]','$atd','$dl01 ','$dl02','$dur 01','$dur02',
'$ttldur')";
$simpan=mysql_q uery($tambah,$k oneksi)or die (mysql_error()) ;
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitl ed Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<table width="894" height="828" border="0" cellpadding="0" cellspacing="0" >
<!--DWLayoutTable-->
<tr>
<td width="1148" height="31" valign="top"><!--DWLayoutEmptyCe ll--> </td>
</tr>
<tr>
<td height="797" align="left" valign="top"><f orm name="form6" method="post" action="<?php _SELF ?>">
<table style="clear:bo th" width="396" border="1" cellpadding="0" cellspacing="1" bordercolor="#0 00000">
<!--DWLayoutTable-->
<tr>
<td width="125"><sp an class="style17" >Date(dd/mm/yy)</span></td>
<td width="33"><inp ut name="tgl" type="text" id="tgl" value="<?php echo"$tanggal" ?>" size="4"></td>
<td width="42"><inp ut name="bulan" type="text" id="bulan" value="<?php echo"$angkabln" ?>" size="5"></td>
<td width="73"><inp ut name="tahun" type="text" id="tahun" onChange="this. form.submit" value="<?php echo"$namathn" ?>" size="8"></td>
<td width="43" align="center"> <span class="style17" >Day</span></td>
<td width="59"><spa n class="style17" >
<input name="hari" type="text" id="hari" value="<?php echo"$harike" ?>" size="4">
</span></td>
</tr>
</table>
<table width="894" height="231" border="1" cellspacing="1" bordercolor="#0 10101" bgcolor="#E0DFE 3">
<!--DWLayoutTable-->
<tr>
<td colspan="17" bgcolor="#7BA0D F"><div align="center" class="style18" >Departure Flight </div></td>
</tr>
<tr>
<td colspan="2" class="style21" >Flight Number </td>
<td width="107"><di v align="left">
<input name="fltdep" type="text" value="<?php echo"$fltdep" ?>" size="16" onChange="this. form.submit">
</div></td>
<td width="65" colspan="5" class="style21" ><!--DWLayoutEmptyCe ll--> </td>
<td colspan="8" class="style21" >A/C Configuration</td>
</tr>
<tr>
<td height="26" colspan="2" class="style21" ><span class="style21" >Acft Registration</span></td>
<td><input name="reg" type="text" id="reg" value="<?php echo"$reg"?>" size="16"></td>
<td colspan="5" class="style21" > </td>
<td colspan="3" align="center" valign="middle" bgcolor="#F8EDA D" class="style21" ><div align="center"> C</div></td>
<td bgcolor="#F8EDA D" class="style21" ><div align="center"> Y</div></td>
<td colspan="3" class="style21" > </td>
</tr>
<tr>
<td colspan="2" class="style21" >A/C Type</td>
<td><input name="tipe" type="text" id="tipe" value="<?php echo"$dpt_reg[type]"?>" size="16"></td>
<td colspan="2" align="center" bgcolor="#F8EDA D" class="style21" >A/C Category</td>
<td colspan="3" class="style21" ><input name="categori" type="radio" value="1">
W/B</td>
<td colspan="3" align="center" valign="top" class="style21" ><input name="configc" type="text" id="configc" value="<?php echo"$dpt_reg[configc]"?>" size="7"></td>
<td width="60" align="center" class="style21" ><input name="configc2" type="text" id="configc2" value="<?php echo"$dpt_reg[configy]"?>" size="7"></td>
<td width="231" align="center" class="style21" ><!--DWLayoutEmptyCe ll--> </td>
<td colspan="2" class="style21" ><!--DWLayoutEmptyCe ll--> </td>
</tr>
<tr>
<td colspan="2" bgcolor="#F8EDA D" class="style21" >STD</td>
<td><input name="std" type="text" id="std" value="<?php echo"$row_std[std]" ?>" size="16"></td>
<td colspan="2" align="center" class="style21" > ATD</td>
<td colspan="3" class="style21" ><input name="atd" type="text" id="atd" value="<?php echo"$atd" ?>" size="12"></td>
<td colspan="8" valign="top" class="style21" ><!--DWLayoutEmptyCe ll--> </td>
</tr>
<tr>
<td colspan="2" class="style21" >Gate number </td>
<td><input name="gate" type="text" id="gate" value="<?php echo"$gate" ?>" size="16"></td>
<td colspan="2" align="center" class="style21" >Stand Number</td>
<td colspan="3" class="style21" ><input name="bay" type="text" id="bay" value="<?php echo"$bay" ?>" size="12"></td>
<td colspan="8" valign="top" class="style21" ><!--DWLayoutEmptyCe ll--> </td>
</tr>
<tr>
<td width="48" height="13" class="style21" >Del01</td>
<td width="71" class="style21" ><div align="center">
<input name="dl01" type="text" id="dl01" value="<?php echo"$dl01" ?>" size="4">
</div></td>
<td colspan="2" align="center" class="style21" >Duration01(H H/MM)</td>
<td class="style21" ><input name="jam01" type="text" id="jam01" value="<?php echo"$jam01" ?>" size="5"></td>
<td width="42" align="center" valign="middle" class="style21" ><input name="min01" type="text" id="min01" value="<?php echo"$min01" ?>" size="5"></td>
<td colspan="11" align="center" class="style21" ><div align="left"><s pan class="style13" >Must be filled with zero if no delay </span></div></td>
</tr>
<tr>
<td height="13" class="style21" >Del 02 </td>
<td height="13" class="style21" ><div align="center">
<input name="dl02" type="text" id="dl02" value="<?php echo"$dl02" ?>" size="4">
</div></td>
<td colspan="2" align="center" class="style21" >Duration02(H H/MM)</td>
<td width="64" class="style21" ><input name="jam02" type="text" id="jam02" value="<?php echo"$jam02" ?>" size="5"></td>
<td align="center" valign="middle" class="style21" ><input name="min02" type="text" id="min02" value="<?php echo"$min02" ?>" size="5"></td>
<td colspan="11" align="center" class="style21" ><div align="left">
<div align="left"><s pan class="style13" >Must be filled with zero if no delay </span></div>
</div></td>
</tr>
<tr>
<td height="13" colspan="2" class="style21" >Total Duration </td>
<td colspan="2" class="style21" ><div align="center">
<input name="ttldur" type="text" id="ttldur" value="<?php echo"$ttldur" ?>" size="12">
</div></td>
<td colspan="13" class="style21" ><!--DWLayoutEmptyCe ll--> </td>
</tr>
</table>
<table width="894" border="1" cellspacing="1" bordercolor="#0 00000">
<tr>
<td width="306">&nb sp;</td>
<?php if($act!=="save "){?>
<td width="118" align="center"> <input name="save" type="submit" id="save" value="Save">
<?php } ?></td>
<td width="88">&nbs p;</td>
<td width="359">&nb sp;</td>
</tr>
</table>
</form></td>
</tr>
</table>
</body>
</html>[/PHP]
I try to make small web database in my unit.
Some of fields have on change behaviour to get other data that automatically filled other text field. But when i try to hit "enter" after i fill text field , its automatically save data in my table database . I just want to save data after , i click "save" button.
[PHP]<?php
include"session .php";
mb_http_input(" iso-8859-1");
mb_http_output( "iso-8859-1");
$tgl=$_POST["tgl"];
$bln=$_POST["bulan"];
$thn=$_POST["tahun"];
$hari=mktime(0, 0,0,$bln,$tgl,$ thn);
$harike=date("N ",$hari);
$angkabln=date( "m",$hari);
$namabln=date(" F",$hari);
$namathn=date(" Y",$hari);
$tanggal=date(" d",$hari);
$year=date("Ymd ",$hari);
$fltdep=$_POST["fltdep"];
$reg=$_POST["reg"];
$save=$_POST["save"];
$categori=$_POS T["categori"];
$std=$_POST["std"];
$gate=$_POST["gate"];
$bay=$_POST["bay"];
$configc=$_POST["configc"];
$configy=$_POST["configy"];
$atd=$_POST["atd"];
$dl01=$_POST["dl01"];
$dl02=$_POST["dl02"];
$jam01=$_POST["jam01"];
$min01=$_POST["min01"];
$dur1=mktime($j am01,$min01,0,0 ,0,0);
$dur01=date("H: i",$dur1);
$jam02=$_POST["jam02"];
$min02=$_POST["min02"];
$dur2=mktime($j am02,$min02,0,0 ,0,0);
$dur02=date("H: i",$dur2);
$ttljam=$jam01+ $jam02;
$ttlmin=$min01+ $min02;
$ttl=mktime($tt ljam,$ttlmin,0, 0,0,0);
$ttldur=date("H :i",$ttl);
$btnsave=$_POST["save"];
//cek registrasi//
include("../koneksi.php");
$cek_reg=mysql_ query("select *from tblacft where registrasi='$re g'",$koneksi) or die(mysql_error ());
$dpt_reg=mysql_ fetch_array($ce k_reg);
//cek skedule//
$cek_std=mysql_ query("select * from tblskeddep where day='$harike' and fltnbr='$fltdep '",$koneksi)
or die(mysql_error ());
$row_std=mysql_ fetch_array($ce k_std);
//input data//
if(isset($act)) {
$tambah="INSERT INTO tbldataflt(airl inekode,day,tgl ,bulan,tahun,fl tdep,reg,type,g ate,bay,categor i,configc,confi gy,ahan,pax,otp ,
std,atd,del01,d el02,dur01,dur0 2,ttldur) VALUES('$kode', '$harike','$yea r','$namabln',' $namathn','$flt dep','$reg','$d pt_reg[type]','$gate','$bay ','$categori1',
'$dpt_reg[configc]','$dpt_reg[configy]','$ahan1','$pa x1','$otp1','$r ow_std[std]','$atd','$dl01 ','$dl02','$dur 01','$dur02',
'$ttldur')";
$simpan=mysql_q uery($tambah,$k oneksi)or die (mysql_error()) ;
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitl ed Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<table width="894" height="828" border="0" cellpadding="0" cellspacing="0" >
<!--DWLayoutTable-->
<tr>
<td width="1148" height="31" valign="top"><!--DWLayoutEmptyCe ll--> </td>
</tr>
<tr>
<td height="797" align="left" valign="top"><f orm name="form6" method="post" action="<?php _SELF ?>">
<table style="clear:bo th" width="396" border="1" cellpadding="0" cellspacing="1" bordercolor="#0 00000">
<!--DWLayoutTable-->
<tr>
<td width="125"><sp an class="style17" >Date(dd/mm/yy)</span></td>
<td width="33"><inp ut name="tgl" type="text" id="tgl" value="<?php echo"$tanggal" ?>" size="4"></td>
<td width="42"><inp ut name="bulan" type="text" id="bulan" value="<?php echo"$angkabln" ?>" size="5"></td>
<td width="73"><inp ut name="tahun" type="text" id="tahun" onChange="this. form.submit" value="<?php echo"$namathn" ?>" size="8"></td>
<td width="43" align="center"> <span class="style17" >Day</span></td>
<td width="59"><spa n class="style17" >
<input name="hari" type="text" id="hari" value="<?php echo"$harike" ?>" size="4">
</span></td>
</tr>
</table>
<table width="894" height="231" border="1" cellspacing="1" bordercolor="#0 10101" bgcolor="#E0DFE 3">
<!--DWLayoutTable-->
<tr>
<td colspan="17" bgcolor="#7BA0D F"><div align="center" class="style18" >Departure Flight </div></td>
</tr>
<tr>
<td colspan="2" class="style21" >Flight Number </td>
<td width="107"><di v align="left">
<input name="fltdep" type="text" value="<?php echo"$fltdep" ?>" size="16" onChange="this. form.submit">
</div></td>
<td width="65" colspan="5" class="style21" ><!--DWLayoutEmptyCe ll--> </td>
<td colspan="8" class="style21" >A/C Configuration</td>
</tr>
<tr>
<td height="26" colspan="2" class="style21" ><span class="style21" >Acft Registration</span></td>
<td><input name="reg" type="text" id="reg" value="<?php echo"$reg"?>" size="16"></td>
<td colspan="5" class="style21" > </td>
<td colspan="3" align="center" valign="middle" bgcolor="#F8EDA D" class="style21" ><div align="center"> C</div></td>
<td bgcolor="#F8EDA D" class="style21" ><div align="center"> Y</div></td>
<td colspan="3" class="style21" > </td>
</tr>
<tr>
<td colspan="2" class="style21" >A/C Type</td>
<td><input name="tipe" type="text" id="tipe" value="<?php echo"$dpt_reg[type]"?>" size="16"></td>
<td colspan="2" align="center" bgcolor="#F8EDA D" class="style21" >A/C Category</td>
<td colspan="3" class="style21" ><input name="categori" type="radio" value="1">
W/B</td>
<td colspan="3" align="center" valign="top" class="style21" ><input name="configc" type="text" id="configc" value="<?php echo"$dpt_reg[configc]"?>" size="7"></td>
<td width="60" align="center" class="style21" ><input name="configc2" type="text" id="configc2" value="<?php echo"$dpt_reg[configy]"?>" size="7"></td>
<td width="231" align="center" class="style21" ><!--DWLayoutEmptyCe ll--> </td>
<td colspan="2" class="style21" ><!--DWLayoutEmptyCe ll--> </td>
</tr>
<tr>
<td colspan="2" bgcolor="#F8EDA D" class="style21" >STD</td>
<td><input name="std" type="text" id="std" value="<?php echo"$row_std[std]" ?>" size="16"></td>
<td colspan="2" align="center" class="style21" > ATD</td>
<td colspan="3" class="style21" ><input name="atd" type="text" id="atd" value="<?php echo"$atd" ?>" size="12"></td>
<td colspan="8" valign="top" class="style21" ><!--DWLayoutEmptyCe ll--> </td>
</tr>
<tr>
<td colspan="2" class="style21" >Gate number </td>
<td><input name="gate" type="text" id="gate" value="<?php echo"$gate" ?>" size="16"></td>
<td colspan="2" align="center" class="style21" >Stand Number</td>
<td colspan="3" class="style21" ><input name="bay" type="text" id="bay" value="<?php echo"$bay" ?>" size="12"></td>
<td colspan="8" valign="top" class="style21" ><!--DWLayoutEmptyCe ll--> </td>
</tr>
<tr>
<td width="48" height="13" class="style21" >Del01</td>
<td width="71" class="style21" ><div align="center">
<input name="dl01" type="text" id="dl01" value="<?php echo"$dl01" ?>" size="4">
</div></td>
<td colspan="2" align="center" class="style21" >Duration01(H H/MM)</td>
<td class="style21" ><input name="jam01" type="text" id="jam01" value="<?php echo"$jam01" ?>" size="5"></td>
<td width="42" align="center" valign="middle" class="style21" ><input name="min01" type="text" id="min01" value="<?php echo"$min01" ?>" size="5"></td>
<td colspan="11" align="center" class="style21" ><div align="left"><s pan class="style13" >Must be filled with zero if no delay </span></div></td>
</tr>
<tr>
<td height="13" class="style21" >Del 02 </td>
<td height="13" class="style21" ><div align="center">
<input name="dl02" type="text" id="dl02" value="<?php echo"$dl02" ?>" size="4">
</div></td>
<td colspan="2" align="center" class="style21" >Duration02(H H/MM)</td>
<td width="64" class="style21" ><input name="jam02" type="text" id="jam02" value="<?php echo"$jam02" ?>" size="5"></td>
<td align="center" valign="middle" class="style21" ><input name="min02" type="text" id="min02" value="<?php echo"$min02" ?>" size="5"></td>
<td colspan="11" align="center" class="style21" ><div align="left">
<div align="left"><s pan class="style13" >Must be filled with zero if no delay </span></div>
</div></td>
</tr>
<tr>
<td height="13" colspan="2" class="style21" >Total Duration </td>
<td colspan="2" class="style21" ><div align="center">
<input name="ttldur" type="text" id="ttldur" value="<?php echo"$ttldur" ?>" size="12">
</div></td>
<td colspan="13" class="style21" ><!--DWLayoutEmptyCe ll--> </td>
</tr>
</table>
<table width="894" border="1" cellspacing="1" bordercolor="#0 00000">
<tr>
<td width="306">&nb sp;</td>
<?php if($act!=="save "){?>
<td width="118" align="center"> <input name="save" type="submit" id="save" value="Save">
<?php } ?></td>
<td width="88">&nbs p;</td>
<td width="359">&nb sp;</td>
</tr>
</table>
</form></td>
</tr>
</table>
</body>
</html>[/PHP]