tnx devnull for your time u spend on me. As i said i am new in programming soz about any mistakes!!
still it doesnt work....
i post u all 3 files u may find any mistakes...
<!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>
<script src="js3.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
Code:
</head>
<body>
<form>
search:
<input type="text" size="30" onkeyup="finding(this.value)"/>
</form>
<p><div id="Result"></div>
</p>
</body>
</html>
Code:
var xmlHttp;
function finding(str) {
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (E) {
xmlhttp = new XMLHttpRequest();
}
}
if(!xmlhttp) {
alert("Browser does not support HTTP Request");
return;
}
var url="data.php";
url=url+"?productname="+str;
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}
function stateChanged()
{
if(xmlHttp.readyState==4 && xmlHttp.status==200)
{
document.getElementById("result").innerHTML=xmlHttp.responseText
}
}
function stateChanged()
{
if(xmlHttp.readyState==4 && xmlHttp.status==200)
{
document.getElementById("result").innerHTML=xmlHttp.responseText
}
}
function GetXmlHttpObject()
{
var xmlHttp=null;
}
PHP Code:
<?php require_once('../Connections/Mysitedb.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($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;
}
}
$colname_Recordset1 = "-1";
if (isset($_GET['productname'])) {
$colname_Recordset1 = $_GET['productname'];
}
mysql_select_db($database_Mysitedb, $Mysitedb);
$query_Recordset1 = sprintf("SELECT manufacturer, productname, price FROM products WHERE productname = %s", GetSQLValueString($colname_Recordset1, "text"));
$Recordset1 = mysql_query($query_Recordset1, $Mysitedb) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<!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=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<?php do { ?>
<form id="form1" name="form1" method="post" action="">
<table width="353">
<tr>
<td width="59">name:</td>
<td width="282"><?php echo $row_Recordset1['productname']; ?></td>
</tr>
<tr>
<td>brand:</td>
<td><?php echo $row_Recordset1['manufacturer']; ?></td>
</tr>
<tr>
<td>price</td>
<td><?php echo $row_Recordset1['price']; ?></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
</table>
</form>
<?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>