Php auto complete from database

i have an auto complete form built with jquery and php and is working well but can someone help on how to insert the populated result into database

can you be a bit more specific? you want to to take whats in the input text field and put it into a database?

yes …dis is a bit of my code

my html page
<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN”
http://www.w3.org/TR/html4/loose.dtd”>
<html>
<head>
<title>jQuery AutoComplete tutorial using multiple input boxes</title>

&lt;style type="text/css" title="currentStyle"&gt;
            @import "css/themes/smoothness/jquery-ui-1.8.4.custom.css";
			 @import"css/layout-styles.css" ;
&lt;/style&gt;

&lt;meta http-equiv="Content-Type" content="text/html;charset=utf-8" /&gt;

&lt;!-- jQuery libs --&gt;
&lt;script  type="text/javascript" src="js/jquery-1.6.1.min.js"&gt;&lt;/script&gt;
&lt;script  type="text/javascript" src="js/jquery-ui-1.8.14.custom.min.js"&gt;&lt;/script&gt;

&lt;!-- Our jQuery Script to make everything work --&gt;
&lt;script  type="text/javascript" src="js/jq-ac-script.js"&gt;&lt;/script&gt;

<link href=“…/main.css” rel=“stylesheet”>

</head>
<body>
<div id=“main” align=“center”>

<?php include_once(“…/template_header.php”);?>
<div id=“content”>
<section>
<div class=“panel”>
<form action=“register.php” method=“POST” id=“itemsForm” >

                            &lt;table id="itemsTable" class="general-table"&gt;
                                &lt;thead&gt;
                                &lt;tr&gt;
                                    &lt;th&gt;&lt;/th&gt;
                                    &lt;th&gt;Course Code&lt;/th&gt;
                                    &lt;th&gt;Course Description&lt;/th&gt;
                                    &lt;th&gt;Course Unit&lt;/th&gt;
                                &lt;/tr&gt;
                                &lt;/thead&gt;
                                &lt;tbody&gt;
                                    &lt;tr class="item-row"&gt;
                                        &lt;td&gt;&lt;/td&gt;
                                       &lt;div align="center" &gt;&lt;img src="../images/COURSE.png"/&gt;&lt;/div&gt;

             &lt;td&gt;&lt;input name="courseCode[]" value="" class="tInput"  size="10" id="courseCode" tabindex="1" type="text"/&gt; &lt;/td&gt;
             &lt;td&gt;&lt;input name="courseDesc[]" size="50" class="tInput" id="courseDesc" value=""   readonly="readonly" /&gt;&lt;/td&gt;
              &lt;td&gt;&lt;input name="courseUnit[]" value="" class="tInput" id="courseUnit" size="5" readonly /&gt; &lt;/td&gt;
                                    &lt;td&gt;&lt;input type="hidden" name="std_id"&gt;&lt;/td&gt;
                                    &lt;/tr&gt;
                                &lt;/tbody&gt;
                            &lt;/table&gt;

                        &lt;/form&gt;

                        &lt;a href="#" id="addRow" class="button-clean large"&gt;&lt;span&gt; &lt;img src="images/icon-plus.png" alt="Add" title="Add Row" /&gt; Add Course&lt;/span&gt;&lt;/a&gt;

  &lt;/div&gt;
  &lt;input name="sumit" type="submit"&gt;

the php page
<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN”
http://www.w3.org/TR/html4/loose.dtd”>
<html>
<head>
<title>jQuery AutoComplete tutorial using multiple input boxes</title>

&lt;style type="text/css" title="currentStyle"&gt;
            @import "css/themes/smoothness/jquery-ui-1.8.4.custom.css";
			 @import"css/layout-styles.css" ;
&lt;/style&gt;

&lt;meta http-equiv="Content-Type" content="text/html;charset=utf-8" /&gt;

&lt;!-- jQuery libs --&gt;
&lt;script  type="text/javascript" src="js/jquery-1.6.1.min.js"&gt;&lt;/script&gt;
&lt;script  type="text/javascript" src="js/jquery-ui-1.8.14.custom.min.js"&gt;&lt;/script&gt;

&lt;!-- Our jQuery Script to make everything work --&gt;
&lt;script  type="text/javascript" src="js/jq-ac-script.js"&gt;&lt;/script&gt;

<link href=“…/main.css” rel=“stylesheet”>

</head>
<body>
<div id=“main” align=“center”>

<?php include_once(“…/template_header.php”);?>
<div id=“content”>
<section>
<div class=“panel”>
<form action=“register.php” method=“POST” id=“itemsForm” >

                            &lt;table id="itemsTable" class="general-table"&gt;
                                &lt;thead&gt;
                                &lt;tr&gt;
                                    &lt;th&gt;&lt;/th&gt;
                                    &lt;th&gt;Course Code&lt;/th&gt;
                                    &lt;th&gt;Course Description&lt;/th&gt;
                                    &lt;th&gt;Course Unit&lt;/th&gt;
                                &lt;/tr&gt;
                                &lt;/thead&gt;
                                &lt;tbody&gt;
                                    &lt;tr class="item-row"&gt;
                                        &lt;td&gt;&lt;/td&gt;
                                       &lt;div align="center" &gt;&lt;img src="../images/COURSE.png"/&gt;&lt;/div&gt;

             &lt;td&gt;&lt;input name="courseCode[]" value="" class="tInput"  size="10" id="courseCode" tabindex="1" type="text"/&gt; &lt;/td&gt;
             &lt;td&gt;&lt;input name="courseDesc[]" size="50" class="tInput" id="courseDesc" value=""   readonly="readonly" /&gt;&lt;/td&gt;
              &lt;td&gt;&lt;input name="courseUnit[]" value="" class="tInput" id="courseUnit" size="5" readonly /&gt; &lt;/td&gt;
                                    &lt;td&gt;&lt;input type="hidden" name="std_id"&gt;&lt;/td&gt;
                                    &lt;/tr&gt;
                                &lt;/tbody&gt;
                            &lt;/table&gt;

                        &lt;/form&gt;

                        &lt;a href="#" id="addRow" class="button-clean large"&gt;&lt;span&gt; &lt;img src="images/icon-plus.png" alt="Add" title="Add Row" /&gt; Add Course&lt;/span&gt;&lt;/a&gt;

  &lt;/div&gt;
  &lt;input name="sumit" type="submit"&gt;

and my javascript page
$(document).ready(function(){

// Use the .autocomplete() method to compile the list based on input from user
$('#courseCode').autocomplete({
    source: 'data/item-data.php',
    minLength: 1,
    select: function(event, ui) {
        var $itemrow = $(this).closest('tr');
                // Populate the input fields from the returned values
                $itemrow.find('#courseCode').val(ui.item.courseCode);
                $itemrow.find('#courseDesc').val(ui.item.courseDesc);
                $itemrow.find('#courseUnit').val(ui.item.courseUnit);

                // Give focus to the next input field to recieve input from user

        return false;
    }
// Format the list menu output of the autocomplete
}).data( "autocomplete" )._renderItem = function( ul, item ) {
    return $( "&lt;li&gt;&lt;/li&gt;" )
        .data( "item.autocomplete", item )
        .append( "&lt;a&gt;" + item.courseCode + " - " + item.courseDesc + "&lt;/a&gt;" )
        .appendTo( ul );
};

// Get the table object to use for adding a row at the end of the table
var $itemsTable = $('#itemsTable');

// Create an Array to for the table row. ** Just to make things a bit easier to read.
var rowTemp = [
    '&lt;tr class="item-row"&gt;',
        '&lt;td&gt;&lt;a id="deleteRow"&gt;&lt;img src="images/icon-minus.png" alt="Remove Item" title="Remove Item"&gt;&lt;/a&gt;&lt;/td&gt;',
        '&lt;td&gt;&lt;input name="courseCode[]" class="tInput" value="" id="courseCode" size="10" type="text" /&gt; &lt;/td&gt;',
        '&lt;td&gt;&lt;input name="courseDesc[]" class="tInput" value="" id="courseDesc"  readonly="readonly"  size="50"/&gt;&lt;/td&gt;',
        '&lt;td&gt;&lt;input name="courseUnit[]" class="tInput" value="" id="courseUnit" size="5"  /&gt;&lt;/td&gt;',
    '&lt;/tr&gt;'
].join('');

// Add row to list and allow user to use autocomplete to find items.
$("#addRow").bind('click',function(){

    var $row = $(rowTemp);

    // save reference to inputs within row
    var $courseCode 	        = $row.find('#courseCode');
    var $courseDesc 	        = $row.find('#courseDesc');
    var $courseUnit	        = $row.find('#courseUnit');

    if ( $('#courseCode:last').val() !== '' ) {

        // apply autocomplete widget to newly created row
        $row.find('#courseCode').autocomplete({
            source: 'data/item-data.php',
            minLength: 1,
            select: function(event, ui) {
                $courseCode.val(ui.item.courseCode);
                $courseDesc.val(ui.item.courseDesc);
                $courseUnit.val(ui.item.courseUnit);

                // Give focus to the next input field to recieve input from user

                return false;
            }
        }).data( "autocomplete" )._renderItem = function( ul, item ) {
            return $( "&lt;li&gt;&lt;/li&gt;" )
                .data( "item.autocomplete", item )
                .append( "&lt;a&gt;" + item.courseCode + " - " + item.courseDesc + "&lt;/a&gt;" )
                .appendTo( ul );
        };
        // Add row after the first row in table
        $('.item-row:last', $itemsTable).after($row);
        $($courseCode).focus();

    } // End if last courseCode input is empty
    return false;
});

$('#courseCode').focus(function(){
    window.onbeforeunload = function(){ return "You haven't saved your data.  Are you sure you want to leave this page without saving first?"; };
});

}); // End DOM

// Remove row when clicked
$("#deleteRow").live('click',function(){
	$(this).parents('.item-row').remove();
    // Hide delete Icon if we only have one row in the list.
    if ($(".item-row").length &lt; 2) $("#deleteRow").hide();
});