Home about IT Motivation Course Sales Project About Me

Saturday, March 28, 2009

multiple submit

beri nama produk2.php

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<link href="../../inetpub/wwwroot/anggunblog/style/main.css" rel="stylesheet" type="text/css" />
</head>

<body>
<form id="form1" name="form1" method="post" action="cek_produk2.php">

<SCRIPT LANGUAGE="JavaScript" SRC="/sspcp/CalendarPopup.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript">
var cal = new CalendarPopup();
</script>




User Name: <SELECT NAME=produk1 >
<?
echo "<OPTION VALUE=0 SELECTED>-- Select User Name --";
include "koneksi_detik.php";
$tampil="SELECT * FROM muser ORDER BY name_muser";
$hasil=mysql_query($tampil);
while($data=mysql_fetch_array($hasil))
{
echo "<OPTION VALUE=$data[name_muser]>$data[name_muser] = $data[dept_muser]";
}
echo "</OPTION></SELECT> ";
?>




<p>PR Date:
<SCRIPT LANGUAGE="JavaScript" ID="js1">
var cal1 = new CalendarPopup();
</SCRIPT>
<!-- The next line prints out the source in this example page.
It should not be included when you actually use the calendar popup code -->
<SCRIPT LANGUAGE="JavaScript">writeSource("js1");</SCRIPT>
<INPUT TYPE="text" NAME="date1" VALUE="" SIZE=10>
<A HREF="#" onClick="cal1.select(document.forms[0].date1,'anchor1','yyyy-MM-dd');
return false;" TITLE="cal1.select(document.forms[0].date1,'anchor1','MM/dd/yyyy');
return false;" NAME="anchor1" ID="anchor1">select</A>
format: yyyy-mm-dd</td>
</tr>

</p>



--No--|---------------Item---------------|---Qty/Unit---|-------------Purpose-------------


<p>...[1]...
<input style="background-color:#f1f1f1; border-color:#777777; type="text" size="30" maxlength="30" name="produk3[]" id="textfield" />
<input style="background-color:#f1f1f1; border-color:#777777; type="text" size="10" maxlength="10" name="produk4[]" id="textfield" />
<input style="background-color:#f1f1f1; border-color:#777777; type="text" size="30" maxlength="30" name="produk5[]" id="textfield" />
</p>

<p>...[2]...
<input style="background-color:#f1f1f1; border-color:#777777; type="text" size="30" maxlength="30" name="produk3[]" id="textfield" />
<input style="background-color:#f1f1f1; border-color:#777777; type="text" size="10" maxlength="10" name="produk4[]" id="textfield" />
<input style="background-color:#f1f1f1; border-color:#777777; type="text" size="30" maxlength="30" name="produk5[]" id="textfield" />
</p>

<p>...[3]...
<input style="background-color:#f1f1f1; border-color:#777777; type="text" size="30" maxlength="30" name="produk3[]" id="textfield" />
<input style="background-color:#f1f1f1; border-color:#777777; type="text" size="10" maxlength="10" name="produk4[]" id="textfield" />
<input style="background-color:#f1f1f1; border-color:#777777; type="text" size="30" maxlength="30" name="produk5[]" id="textfield" />
</p>

<p>
<input type="submit" name="button" id="button" value="Submit" />
</p>
</form>

</body>
</html>


beri nama cek_produk2.php

<?php
require_once('koneksi_detik.php');

$count=count($produk3);
$count=count($produk4);
$count=count($produk5);

for ($i = 0; $i < $count; $i++) {

$id3 = $_POST['produk3'][$i];
$id4 = $_POST['produk4'][$i];
$id5 = $_POST['produk5'][$i];

mysql_query("INSERT INTO t_pr (pr_id,pr_usr,pr_dt,pr_itm,pr_qty,pr_pps,pr_sts,pr_po) VALUES ('','$produk1','$date1','$id3','$id4','$id5','','')");
}
?>

No comments: