我有一张桌子,我有一个搜索框(输入类型 =“文本”),您可以在其中输入您在表格中寻找的联系人的姓名和号码。
我想要实现的是,这个类型选择的结果将在同一张表中显示/显示!
我想知道的是如何识别已键入的选择,以便我可以在“SELECT * FROM table WHERE”函数中解决它,然后我可以添加此变量以使 sql 在表中搜索它。
通常我使用 config.php 页面来创建 sql,然后这将在新页面上显示结果,但这次我希望结果显示在同一页面的同一张表中!
这可能吗?
我的搜索框模型:
<legend>Voer het Naam en Nummer in dat je wilt opzoeken</legend>
<input type="text" id="Naam" name="Naam" placeholder="Voer een Naam in" /><br/>
<input type="text" id="Nummer" name="Nummer" placeholder="Voer een Nummer in" /><br/>
我的表:
<?php
include("pagination.php");
if(isset($res))
{
//creating table
echo '<table style="width:1500px; cell-padding:4px; cell-spacing:0; margin:auto;">';
echo'<th>id</th><th>Time</th><th>Answered Y/N</th></th><th>Naam</th><th>Caller ID</th>';
while($result = mysql_fetch_assoc($res))
{
echo '<tr>';
echo '<td>'.$result['callapiid'].'</td>'.'<td>'.$result['statusCalling'].'</td>';
if ($result['statusAnswered'] =="NULL"||$result['statusAnswered'] =="Null" || $result['statusAnswered'] =="null" || $result['statusAnswered'] =="")
{
echo "<td>Not Answered!</td>";
}
else
{
echo "<td>Answered!</td>";
}
echo '<td>'.$result['calleridname'].'</td>'.'<td>'.$result['calleridnum'].'</td>' ;
echo '</tr>';
}
echo '</table>';
}
?>
& $res 变量在 pagination.php :
<?php
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
// select database
mysql_select_db("voizxl_wachtrij", $con); ////provide database name
$query = mysql_query("SELECT * FROM Callflow");
$total_rows = mysql_num_rows($query);
$base_url = 'https://localhost/pagi/';
$per_page = 50; //number of results to shown per page
$num_links = 8; // how many links you want to show
$total_rows = $total_rows;
$cur_page = 1; // set default current page to 1
if(isset($_GET['page']))
{
$cur_page = $_GET['page'];
$cur_page = ($cur_page < 1)? 1 : $cur_page; //if page no. in url is less then 1 or -ve
}
$offset = ($cur_page-1)*$per_page; //setting offset
$pages = ceil($total_rows/$per_page); // no of page to be created
$start = (($cur_page - $num_links) > 0) ? ($cur_page - ($num_links - 1)) : 1;
$end = (($cur_page + $num_links) < $pages) ? ($cur_page + $num_links) : $pages;
$res = mysql_query("SELECT * FROM Callflow LIMIT ".$per_page." OFFSET ".$offset);
mysql_close($con);
?>
我将不胜感激您的帮助和建议,谢谢您!