form.php

<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>
</head>
<body>

<form method="post" action="conn.php">

Name <input type="textbox1" name="Name[]" value=""><br>
Start date <input type="textbox6" name="Startdate[]" id="datepicker"><br>
End date <input type="textbox7" name="Enddate[]" id="datepicker2"><br>
Item <input type="textbox8" name="Item1[]" value=""> Model <input type="textbox8" name="Item1[]" value=""> No.Inventori <input type="textbox8" name="Item1[]" value=""><br>
Item <input type="textbox9" name="Item2[]" value=""> Model <input type="textbox9" name="Item2[]" value=""> No.Inventori <input type="textbox9" name="Item2[]" value=""><br>
Item <input type="textbox10" name="Item3[]" value=""> Model <input type="textbox10" name="Item3[]" value=""> No.Inventori <input type="textbox10" name="Item3[]" value=""><br>
Item <input type="textbox11" name="Item4[]" value=""> Model <input type="textbox11" name="Item4[]" value=""> No.Inventori <input type="textbox11" name="Item4[]" value=""><br>


<input type="submit" name="submit" value="submit">
</form>
</body>
</html>

conn.php

<?php

// Make a MySQL Connection
mysql_connect("localhost", "root", "") or die(mysql_error());
mysql_select_db("pinjaman") or die(mysql_error());

$TextBox1 = implode(', ', $_POST['Name']);
$TextBox6 = implode(', ', $_POST['Startdate']);
$TextBox7 = implode(', ', $_POST['Enddate']);
$TextBox8 = implode(', ', $_POST['Item1']);
$TextBox8 = implode(', ', $_POST['Item1']);
$TextBox8 = implode(', ', $_POST['Item1']);
$TextBox9 = implode(', ', $_POST['Item2']);
$TextBox9 = implode(', ', $_POST['Item2']);
$TextBox9 = implode(', ', $_POST['Item2']);
$TextBox10 = implode(', ', $_POST['Item3']);
$TextBox10 = implode(', ', $_POST['Item3']);
$TextBox10 = implode(', ', $_POST['Item3']);
$TextBox11 = implode(', ', $_POST['Item4']);
$TextBox11 = implode(', ', $_POST['Item4']);
$TextBox11 = implode(', ', $_POST['Item4']);

if(isset($_POST['submit']))
{ 
$query="INSERT INTO epal VALUES ('" . $TextBox1 . "','" . $TextBox6 . "','" . $TextBox7 . "','" . $TextBox8 . "','" . $TextBox9 . "','" . $TextBox10 . "','" . $TextBox11 . "')"; 

mysql_query($query) or die (mysql_error() );

echo "Complete";
}
?>

**i want to short cut the admin works so i need a help how can i get data from database, which is 'item' column and display it in a drop down list?? **

To achive this you need to change 'item type' inside the form as follows:

<?php
// Make a MySQL Connection
mysql_connect("localhost", "root", "") or die(mysql_error());
mysql_select_db("pinjaman") or die(mysql_error());

// prepare a qurey
$query = "SELECT  item FROM tablename"; // here you need to change the 'tablename' as per your table name.

// Get the data from database in a data set
$dataset = mysql_query($query);

if (mysql_num_rows($dataset) > 0) {
    ?>
    <label for="items">Items</label>
    <select name="Item">
        <?php
            while($row = mysql_fetch_object($dataset)) {
                echo "<option value=$row->item>$row->item</option>";
            }
        ?>
    </select>

<?php
}
?>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.