i want little help.how can i insert the multiple data to database?
<?php require_once('Connections/iventori.php'); ?>
<?php
$id = $_GET['idpinjaman'];
$colname_Recordset1 = "-1";
if (isset($_GET['idpinjaman'])) {
$colname_Recordset1 = (get_magic_quotes_gpc()) ? $_GET['idpinjaman'] : addslashes($_GET['idpinjaman']);
}
mysql_select_db($database_pinjaman, $pinjaman);
$query_set1 =sprintf("SELECT * FROM pemohon a,pinjaman b WHERE a.id_pemohon=b.id_pemohon AND b.id_pinjaman='%s'", $colname_Recordset1);
$set1 = mysql_query($query_set1, $pinjaman) or die(mysql_error());
$row_set1 = mysql_fetch_assoc($set1);
$totalRows_set1 = mysql_num_rows($set1);
mysql_select_db($database_pinjaman, $pinjaman);
$query_set2 =sprintf("SELECT * FROM inventori");
$set2 = mysql_query($query_set2, $pinjaman) or die(mysql_error());
$row_set2 = mysql_fetch_assoc($set2);
$totalRows_set2 = mysql_num_rows($set2);
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
//insert untuk maklumat peminjam
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1"))
{
$id_pemohon=$_POST['id_pemohon'];
$tujuan=$_POST['tujuan'];
$date1=$_POST['1'];
$date2=$_POST['2'];
$insertSQL = sprintf("INSERT INTO pinjaman (id_pemohon, tujuan, start_pinjaman, last_pinjaman) VALUES ('$id_pemohon', '$tujuan', '$start_pinjaman', '$last_pinjaman')");
mysql_select_db($database_pinjaman, $pinjaman);
$Result = mysql_query($insertSQL, $pinjaman) or die(mysql_error());
$currentPage = $_SERVER["PHP_SELF"];
}
?>
<html>
<head>
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
<script>
$(document).ready(function() {
$("#datepicker").datepicker({ dateFormat: "dd/mm/yy" });
$("#datepicker2").datepicker({ dateFormat: "dd/mm/yy" });
});
</script>
<!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=iso-8859-1" />
<title>Sistem e-Pinjaman</title>
</head>
<style type="text/css">
<!--
body {
background-image: url(image/background.jpg);
}
.style12{font-family: "Times New Roman";font-size: 18px;color: #000000;font-weight:bold;}
.style13 {font-size: 12px; color: #000000; font-family: "Times New Roman";}
-->
/* Begin Navigation Bar Styling */
#nav {
width: 100%;
float: left;
margin: 0 0 3em 0;
padding: 0;
list-style: none;
background-color: #FFFF66;
border-bottom: 1px solid #ccc;
border-top: 1px solid #ccc; }
#nav li {
float: left; }
#nav li a {
display: block;
padding: 8px 15px;
text-decoration: none;
font-weight: bold;
color: #069;
border-right: 1px solid #ccc; }
#nav li a:hover {
color: #c00;
background-color: #fff; }
/* End navigation bar styling. */
/* This is just styling for this specific page. */
body {
background-color: #555;
font: small/1.3 Arial, Helvetica, sans-serif; }
#wrap {
width: 871px;
margin: 0 auto;
background-color: #fff; }
#select { font-size:15px; }
h1 {
font-size: 1.5em;
padding: 1em 8px;
color: #333;
background-color: #069;
margin: 0; }
#content {
padding: 0 50px 50px; }
</style>
<style type="text/css">
.ui-datepicker {
font-family: Garamond;
font-size: 15px;
margin-left:10px
}
.style21 {font-family: "Times New Roman", Times, serif}
</style>
<style type="text/css">
<!--
body {
background-image: url(image/background.jpg);
}
.style3 {font-family: "Times New Roman";font-size: 14px;color: #000000; }
.style1 {
font-family: "Times New Roman";
font-size: 16px;
color: #000000;
font-weight:bold;
}
.style12{font-family: "Times New Roman";font-size: 18px;color: #000000;font-weight:bold;}
-->
</style>
<body>
<table width="877" height="724" border="0" align="center" bgcolor="#FFFFCC">
<tr>
<td height="124"><img src="image/banner.jpg" width="1000" height="122" /></td>
</tr>
<tr><!--menubar-->
<td height="87"><!--menubar-->
<div id="wrap"><!--menubar-->
<ul id="nav"><!--menubar-->
<li><a href="index.php" class="style1">Laman Utama</a></li><!--menubar-->
<li><a href="pinjaman_1.php" class="style1">Pinjaman</a></li><!--menubar-->
<li><a href="#" class="style1">Tempahan</a></li><!--menubar-->
<li><a href="listperalatanpage.php" class="style1">List peralatan</a></li><!--menubar-->
<li><a href="daftar_1.php" class="style1">Daftar Peralatan</a></li><!--menubar-->
<li><a href="staff_daftar.php" class="style1">Daftar Pengguna</a></li><!--menubar-->
<li><a href="logmasuk.php" class="style1">Log Masuk</a></li><!--menubar-->
</ul><!--menubar-->
</div><!--menubar--> </td><!--menubar-->
</tr><!--menubar-->
<tr><!--time&date-->
<td width="872" align="right" span class="style1"><!--time&date-->
<?php $today = gmdate("j F Y, g:i a",time()+(28800)); ?><!--time&date-->
<?php echo $today;?>
</td><!--time&date-->
</tr><!--time&date-->
<tr>
<td width="872" height="22"><p align="center" class="style12"> MAKLUMAT TEMPAHAN </p></td>
</tr>
<tr>
<td colspan="5" align="center"> </td>
</tr>
<tr>
<td>
<table align="center" width="495">
<tr>
<td width="113">Nama Peminjam</td>
<td width="4">:</td>
<td width="345"><?php echo $row_set1['Nama']; ?></td>
</tr>
<tr>
<td>Jawatan</td>
<td>:</td>
<td><?php echo $row_set1['Jawatan']; ?></td>
</tr>
<tr>
<td>Bahagian</td>
<td>:</td>
<td><?php echo $row_set1['Bahagian']; ?></td>
</tr>
<tr>
<td>Telefon</td>
<td>:</td>
<td><?php echo $row_set1['Tel']; ?></td>
</tr>
<tr>
<td>Tempoh Pinjaman</td>
<td>:</td>
<td><?php echo $row_set1['start_pinjaman']; ?> - <?php echo $row_set1['last_pinjaman']; ?></td>
</tr>
<tr>
<td>Tujuan Pinjaman</td>
<td>:</td>
<td><?php echo $row_set1['tujuan']; ?></td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="872" height="250" class="style12"><table width="900" height="150" border="1" align="center">
<tr bgcolor="#006600">
<th width="128" scope="col"><span class="style17">LAPTOP</span></th>
<th width="128" scope="col"><span class="style17">PROJEKTOR</span></th>
<th width="128" scope="col"><span class="style17">EXTENSION</span></th>
<th width="128" scope="col"><span class="style17">LAYAR</span></th>
<th width="128" scope="col"><span class="style17">KOMPUTER</span></th>
<th width="128" scope="col"><span class="style17">LAIN-LAIN</span></th>
</tr>
<tr bgcolor="#FFCC66">
<td><div align="center">
<form>
<?php
$query = "SELECT no_inventori,model FROM inventori WHERE peralatan='LAPTOP'";
$result = mysql_query($query) or die ("Error in query: $query. ".mysql_error());
if (mysql_num_rows($result) > 0) { ?>
<table border=1 cellpadding=1><?php
while($row = mysql_fetch_array( $result ))
{ ?>
<tr>
<td><input type="checkbox" name=""><?php echo $row['no_inventori'];?></td>
<?php } ?>
</tr>
</table>
<?php }
else {
echo "No rows found!";
}
mysql_free_result($result);
?>
</form></div></td>
<td><div align="center">
<form>
<?php
$query = "SELECT no_inventori,model FROM inventori WHERE peralatan='PROJEKTOR'";
$result = mysql_query($query) or die ("Error in query: $query. ".mysql_error());
if (mysql_num_rows($result) > 0) { ?>
<table border=1 cellpadding=1><?php
while($row = mysql_fetch_array( $result ))
{ ?>
<tr>
<td><input type="checkbox" name=""><?php echo $row['no_inventori'];?></td>
<?php } ?>
</tr>
</table>
<?php }
else {
echo "No rows found!";
}
mysql_free_result($result);
?>
</form></div></td>
<td><div align="center">
<form>
<?php
$query = "SELECT no_inventori,model FROM inventori WHERE peralatan='EXTENSION'";
$result = mysql_query($query) or die ("Error in query: $query. ".mysql_error());
if (mysql_num_rows($result) > 0) { ?>
<table border=1 cellpadding=1><?php
while($row = mysql_fetch_array( $result ))
{ ?>
<tr>
<td><input type="checkbox" name=""><?php echo $row['no_inventori'];?></td>
<?php } ?>
</tr>
</table>
<?php }
else {
echo "No rows found!";
}
mysql_free_result($result);
?>
</form></div></td>
<td><div align="center">
<form>
<?php
$query = "SELECT no_inventori,model FROM inventori WHERE peralatan='LAYAR'";
$result = mysql_query($query) or die ("Error in query: $query. ".mysql_error());
if (mysql_num_rows($result) > 0) { ?>
<table border=1 cellpadding=1><?php
while($row = mysql_fetch_array( $result ))
{ ?>
<tr>
<td><input type="checkbox" name=""><?php echo $row['no_inventori'];?></td>
<?php } ?>
</tr>
</table>
<?php }
else {
echo "No rows found!";
}
mysql_free_result($result);
?>
</form></div></td>
<td><div align="center">
<form>
<?php
$query = "SELECT no_inventori,model FROM inventori WHERE peralatan='KOMPUTER'";
$result = mysql_query($query) or die ("Error in query: $query. ".mysql_error());
if (mysql_num_rows($result) > 0) { ?>
<table border=1 cellpadding=1><?php
while($row = mysql_fetch_array( $result ))
{ ?>
<tr>
<td><input type="checkbox" name=""><?php echo $row['no_inventori'];?></td>
<?php } ?>
</tr>
</table>
<?php }
else {
echo "No rows found!";
}
mysql_free_result($result);
?>
</form></div></td>
<td><div align="center">
<input type="text" name="textfield" /><br/>
<input type="text" name="textfield" /><br/>
<input type="text" name="textfield" /><br/>
</div></td></tr>
</table>
</td>
</tr>
</table>
<tr>
<td>
<p align="center"> </p>
<p align="center"><span class="style13"> Hakcipta Terpelihara 2013. Jabatan Agama Islam Selangor©</a>. <br />
</span></p>
</td>
</tr>
</table>
</body>
</html>