Melayani Dengan Nurani

IA

28 Oktober 2016

Multi Form Dalam Pemrograman PHP

Caranya dengan kombinasi memakai Javasrcipt yang di'simpan' di Head.
<script type="text/javascript" ></script>

function submit_form1(){
document.form1.submit();
}

function submit_form2(){
document.form2.submit();
}

function submit_form2(){
document.form3.submit();
}

</script>

==============================================================
<?php require_once('conn.php'); ?>
<?php include('libfungsi.php'); ?>

<?php
$namapelanggan=" ";
mysql_select_db($database_conn, $conn);
$query_Recordset1 = "SELECT * FROM counter";
$Recordset1 = mysql_query($query_Recordset1, $conn) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Laporan Penjualan  Pelanggan</title>
<br>
<script type="text/javascript">
<!--
function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}
//-->
</script>

<script type="text/javascript" src="../library/calendar.js"></script>
<!-- language for the calendar -->
<script type="text/javascript" src="../library/calendar-en.js"></script>
<script type="text/javascript" src="../library/calendar-setup.js"></script>
<style type="text/css">
<!--
-->
</style>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="../library/calendar-win2k-1.css" rel="stylesheet" type="text/css">
<script language="javascript">

function submit_form1(){
document.form1.submit();
}

function submit_form2(){
document.form2.submit();
}

function submit_form2(){
document.form3.submit();
}

</script>

</head>

<body>
<?php
if (isset($_GET['kode']))
  {
//   echo "data kode sudah ada";
   $kode=$_GET['kode'];

   mysql_select_db($database_conn, $conn);
   $query_Recordset1 = "SELECT * FROM counter WHERE no_reg_konter ='".$kode."'";
   $Recordset1 = mysql_query($query_Recordset1, $conn) or die(mysql_error());
   $row_Recordset1 = mysql_fetch_assoc($Recordset1);
   $totalRows_Recordset1 = mysql_num_rows($Recordset1);
   if ($totalRows_Recordset1 > 0)
       $namapelanggan =$row_Recordset1['counter_name'] ;
//   { echo  " Pelanggan: ".$row_Recordset1['counter_name'] ;}

   }
else
{

 //  echo "sorry data ora ono";
  }
?>

<div align="center"></div>
<h4 align="center"> PILIH PERIODE PENJUALAN PELANGGAN PER TANGGAL</h4>
<table border="0" align="center">
  <tr>
    <form name="form1" id="form1" method="GET" action="<?php echo $_SERVER['PHP_SELF']; ?>">
    <td>  Pilih Pelanggan :    </td>
    <td colspan="2"><select name="kode" onChange="document.getElementById('form1').submit();">
      <?php
do {
?>
      <option value="<?php echo $row_Recordset1['no_reg_konter']?>"><?php echo $row_Recordset1['no_reg_konter']." - ".$row_Recordset1['counter_name']?></option>
      <?php
} while ($row_Recordset1 = mysql_fetch_assoc($Recordset1));
  $rows = mysql_num_rows($Recordset1);
  if($rows > 0) {
      mysql_data_seek($Recordset1, 0);
 $row_Recordset1 = mysql_fetch_assoc($Recordset1);
 $kode= $row_Recordset1['no_reg_konter'];
  }
?>
    </select>
 </td>
</form>
  </tr>

    <tr>
      <td colspan="2"><div align="right">Atau</div></td>
      <td colspan="3">&nbsp;</td>
    </tr>
    <tr>

    <form name="form2" method="GET" action="<?php echo $_SERVER['PHP_SELF']; ?>" >  
        <td colspan="2">      <div align="center"></div>
          <div align="right">Masukan Kode Pelanggan : </div></td>
        <td colspan="3">      <input name="kode" type="text" size="9" maxlength="9"  action="<?php echo $_SERVER['PHP_SELF'];?>" >      <input name="cari" type= "submit" value="cari">      </td>
  </form>
  </tr>
 <?php
  $tmptgl1=date('Y-m-d');
  $tmptgl2=date('Y-m-d') ;
  ?>
</table>

<table width="70%" border="0" align="center">
  <tr>
    <td><h2 align="center"><?php echo $namapelanggan; ?></h2>      </td>
  </tr>
</table>
<form name="form3" action="penjualanplg.php" method="get">
<table border="1" align="center" cellpadding="1" cellspacing="1">
  <tr class="hurup2">
    <td align="left" valign="top">Dari Tanggal :
      <input name="date1" type="text" value="<?php echo $tmptgl1; ?>" id="f_date_a" size="12" />
      <button type="reset" id="f_trigger_a">...</button>
      <input name="kode" type="hidden" value="<?php echo $kode; ?>"></td>
    <td>S/D Tanggal
      <input name="date2" type="text" value="<?php echo $tmptgl2; ?>"id="date2" size="12" />
      <button type="reset" id="f_trigger_b">...</button></td>
    </tr>
  <tr>
    <td colspan="2"><p>Jenis Penjualan :      
   <input name="sistemjual" type="radio" value="Kredit" checked> Kredit
   <input name="sistemjual" type="radio" value="Konsinyasi"> Konsinyasi
   <input name="sistemjual" type="radio" value="Tunai"> Tunai
   <input name="sistemjual" type="radio" value="PE"> PE(Buku Contoh)</p>    </td>

  </tr>
  <tr>
    <td><div align="center">
      <input name="back" type="submit" id="back" onClick="MM_goToURL('parent','../main.php');return document.MM_returnValue" value="Batal">
      <a>      </a></div></td>
    <td><div align="center"><a>
        <input type="submit" name="Submit" value="Proses">
    </a></div></td>
  </tr>
</table>
</form>

<script type="text/javascript">
    Calendar.setup({
        inputField     :    "f_date_a",      // id of the input field
        ifFormat       :    "%Y-%m-%d",       // format of the input field
        showsTime      :    true,            // will display a time selector
        button         :    "f_trigger_a",   // trigger for the calendar (button ID)
        singleClick    :    false,           // double-click mode
        step           :    1                // show all years in drop-down boxes (instead of every other year as default)
    });
</script>
<script type="text/javascript">
    Calendar.setup({
        inputField     :    "f_date_b",      // id of the input field
        ifFormat       :    "%Y-%m-%d",       // format of the input field
        showsTime      :    true,            // will display a time selector
        button         :    "f_trigger_b",   // trigger for the calendar (button ID)
        singleClick    :    false,           // double-click mode
        step           :    1                // show all years in drop-down boxes (instead of every other year as default)
    });
</script>
<?php
function frmtgl($tgl)
{
$tmp=date('Y-m-d',strtotime($tgl));
return ($tmp) ;
}
?>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>

0 comments:

Posting Komentar

Nuhun sudah komentar