0
<form method="post" action="search.php">
Start searching: <input id="search" type="text" size="30" >
<div id="search_results"></div>
<script src="//code.jquery.com/jquery-1.12.0.min.js"></script>
<script src="//code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
<script type="text/javascript" src="search.js"></script>
</id>
</form>
<?php
$searchname=$_POST["search"];
$connection = mysqli_connect("localhost","landryr","landryr","landryr");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$titles = mysqli_query($connection,"select * from actor where <mainactorID> LIKE '%$searchname%'");
while($row = mysqli_fetch_assoc($titles)) {
$result[] = $row['mainactorID'];
}
?>
爲什麼ssearchname不被識別爲變量?我唯一的問題是, 「未定義的索引:在第3行的C:\ wamp \ www \ search.php中搜索」。請請幫忙。用jquery即時搜索
'<輸入ID = 「搜索」 類型= 「文字」 大小= 「30」>' - >'<輸入ID =「search」name =「search」type =「text」size =「30」>'注意添加'name'屬性 – cmorrissey
@cmorrissey - 好,我甚至都沒有看到表單-__- – andre3wap
''那不是你真正的語法,*是它嗎?* –