Notice: Undefined variable: output in C:\xampp\htdocs\tests\ser.php on line 24
i got this problem i don't know why this show ! try everything
any fix !?
this is my code php
the idea of code live search like google
<?php
require_once("conf.php");
if(isset($_POST['SearchValue'])){
$se=$_POST['SearchValue'];
$s=preg_replace("#[^0-9a-z]#i","",$se);
$query=mysql_query("SELECT * FROM search WHERE P_A LIKE '%$s%'");
$connect=mysql_num_rows($query);
if ($connect == 0){
$output="no reset";
}
else {
while ($row = mysql_fetch_array($query)){
$pA = $row ['P_A'];
$pB = $row ['P_B'];
$pC = $row ['P_C'];
$pD = $row ['P_D'];
}
$output .= '<div>' . "" . $pA . "" . $pB . "" . $pC . "" . $pD . '</div>' ;
}
}
echo ($output);
?>
and this is my html code
<html>
<head>
<script src="jquery.min.js"></script>
<script type="text/javascript">
function mysearch(){
var sText =$("input [name='Search']").val();
$.post("ser.php",{SearchValue:sText},function(output){
$("#output").html(output);
}
);
};
</script>
</head>
<body>
<form action="#" method="post">
<input type="text" name="Search" onkeydown="mysearch();" />
<input type="submit" value="search" />
</form>
<div id="output" >
</body>
</html>