There are three fields in this forms:
1.Produk
2.Jumlah
3.Tanggal
I wonder why Tanggal (date) are all 0000-00-00
<html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>jQuery UI Datepicker - Default functionality</title>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.0/themes/base/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.8.3.js"></script>
<script src="http://code.jquery.com/ui/1.10.0/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css" />
<script>
$(function() {
$( "#datepicker" ).datepicker();
});
</script>
</head>
</html>
<h4>STOCK RECORDING SYSTEM</h4>
<!--
<form action="print.php" method="post">
-->
<form enctype="multipart/form-data" method="post" name="form1" target="_self">
<table border="0" width="300">
<tr>
<tr>
<td>Produk :</td><br>
<td><!-- onchange="submit();" -->
<select name="batch">
<option value="-1" >-- Select Address --</option>
<?php
$username='root';
$password='';
$con = mysql_connect('localhost', $username, $password);
mysql_select_db('snack', $con);
$result = mysql_query("SELECT * FROM PO");
while($row = mysql_fetch_array($result))
{
?>
<option value="<?php echo $row['PO'];?>">
<?php echo $row['PO'];?></option>
<?php
}
?>
</select>
</td>
</tr>
<tr>
<td>Jumlah :</td>
<td><input type="text" size="12" maxlength="22" name="Jumlah" value="2 box 1 pack"></td><br>
<tr>
<?php // use date picker to automate date ?>
<td>Tanggal :</td>
<td><input type="date" id="datepicker" size="12" maxlength="22" name="Tanggal" value=""></td><br>
</tr>
<?php
if (isset($_POST['submit'])){
mysql_query("INSERT INTO Stock (Produk,Jumlah,Tanggal) VALUES ('$_POST[batch]','$_POST[Jumlah]','$_POST[Tanggal]')");
echo "<script type=\"text/javascript\">
window.location = \"print.php\";
</script>";
}
?>
</table>
<input name="submit" type="submit" value="Submit">
</form>