我正在尝试在一组选项卡旁边制作一个简单的搜索框,该搜索框仅用于搜索电话类型,我制作了此代码,除了搜索框之外的所有东西都可以工作。它给了我这个错误:注意:未定义的索引:搜索
<form action="" method="post" name="form" >
<body>
<script>
$(function() {
$( "#xx" ).tabs();
});
</script>
<div id="xx" >
<ul>
<li><a href="#all">all phones</a></li>
<li><a href="#small">small</a></li>
<li><a href="#large">large</a></li>
<li><a href="#search">search:<input type="text" name="search">
</a></li>
</ul>
<?php
include 'db.php';
?>
<div id="all">
<?php
$res = mysql_query("SELECT * FROM table1");
while($row = mysql_fetch_array($res))
{
echo 'phone name'.$row[2];
echo 'phone type'.$row[3];
echo 'phone sise'.$row[4];
}
?>
</div>
<div id="small">
<?php
$res2 = mysql_query("SELECT * FROM table1 WHERE phonesize = 'small' ");
while($row = mysql_fetch_array($res2))
{
echo 'phone name'.$row[2];
echo 'phone type'.$row[3];
echo 'phone sise'.$row[4];
}
?>
</div>
<div id="large">
<?php
$res3 = mysql_query("SELECT * FROM table1 WHERE phonesize = 'large' ");
while($row = mysql_fetch_array($res3))
{
echo 'phone name'.$row[2];
echo 'phone type'.$row[3];
echo 'phone sise'.$row[4];
}
?>
</div>
<div id="large">
<?php
$search = $_POST['search'];
$res4 = mysql_query("SELECT * FROM table1 WHERE phonetype = '$search'");
while($row = mysql_fetch_array($res4))
{
echo 'phone name'.$row[2];
echo 'phone type'.$row[3];
echo 'phone sise'.$row[4];
}
?>
</div>
</form>