<?
session_start();
include("opendb.php");
include("test.php");
?>
<link href="css/form.css" type="text/css" rel="stylesheet" media="screen"  />
<html>
<body >



		<link type="text/css" href="css/redmond/jquery-ui-1.8.16.custom.css" rel="stylesheet" />	
		<script type="text/javascript" src="js/jquery-1.6.2.min.js"></script>
		<script type="text/javascript" src="js/jquery-ui-1.8.16.custom.min.js"></script>
			<script type="text/javascript">
			$(function(){
					$("#partcode").autocomplete({
						source: function( request, response ) {
							//alert($(this).attr("id"));
						$.ajax({
							url: "search.php",
							dataType: "json",
							data: "key="+$("#partcode").val(),
							success: function( data ) {
								response( $.map( data, function( item ) {
									return {
										label: item.id+' | '+  item.value     ,
										value: item.id,
										name:item.value

									}
								}));
							}
						});
					}
					
				,
					minLength: 2,
					select: function( event, ui ) {

					$("#partname").val(ui.item.name);
					/*log( ui.item ?
					"Selected: " + ui.item.label :
					"Nothing selected, input was " + this.value);
					*/
					 }
					
					});
		
			});
		</script>



<body bgcolor='ivory'>

<table>
<tr>
<td>CustomerName</td><td>



<input name='partcode' type="text" value="" id='partcode' >
<input name='partname' type="text" value="" id='partname' >
<input name='rate' type="text" value="" id='rate' >

</td></tr>


</table>
</form>







