【发布时间】:2016-02-10 20:23:19
【问题描述】:
如何在表格之后向表格添加编辑。 任何帮助将不胜感激。我尝试了许多变体,例如:尝试添加编辑
<center><?php
//connect to mysql for search
if(isset($_POST['search']))
{
$valueToSearch = $_POST['valueToSearch'];
// search in all table columns
// using concat mysql function
$query = "SELECT * FROM `2016server` WHERE CONCAT(`ServerGroup`,
`Week`, `Status`, `ServerName`, `IP`, `DateComplete`, `DateSched`,
`HeatTicket`) LIKE '%".$valueToSearch."%'";
$search_result = filterTable($query);
}
else {
$query = "SELECT * FROM `2016server`";
$search_result = filterTable($query);
}
// function to connect and execute the query
function filterTable($query)
{
$connect = mysqli_connect("localhost", "root", "", "");
$filter_Result = mysqli_query($connect, $query);
return $filter_Result;
}
?>
//start the webpage
<html>
<head>
<title>SEARCH 2016 Servers</title>
</head>
<body>
<center><h3>Type in your query to search all of the 2016
Servers</h3><br>
<form action="search2016.php" method="post">
<input type="text" name="valueToSearch" placeholder="SEARCH">
<input type="submit" name="search" value="GO!"><br><br>
table
<table>
<tr>
<th>ServerGroup</th>
<th>Server Name</th>
<th>Date Scheduled</th>
<th>Heat Ticket</th>
<th>Status</th>
<th>Date Complete</th>
<th>Week</th>
<th>Downtime</th>
<th>IP Address</th>
<th>Operating System</th>
</tr>
populate table from mysql database
<?php while($row = mysqli_fetch_array($search_result)):?>
<tr>
<td><?php echo $row['ServerGroup'];?></td>
<td><?php echo $row['ServerName'];?></td>
<td><?php echo $row['DateSched'];?></td>
<td><?php echo $row['HeatTicket'];?></td>
<td><?php echo $row['Status'];?></td>
<td><?php echo $row['DateComplete'];?></td>
<td><?php echo $row['Week'];?></td>
<td><?php echo $row['DT'];?></td>
<td><?php echo $row['IP'];?></td>
<td><?php echo $row['os'];?></td>
这是我尝试在表格中添加编辑的部分。从上面的编辑代码中,它试图使用 ID 转到 2016edit.php 页面,但是由于没有这样的页面,它会收到 404 错误。
</tr>
<?php endwhile;?>
</table>
</form>
</body>
</html>
【问题讨论】:
-
呃.......什么?你能更清楚地解释你想要做什么吗?
-
我有一个表,我正在尝试编辑。点击编辑链接后,会进入一个php页面,你可以更新信息,然后提交给服务器。
-
如果你想有一个额外的页面进行编辑,为什么不使用表单?
-
我有一个表格供用户查看...我正在尝试在每一行上获取一个编辑链接,该链接将转到另一个页面进行编辑。
标签: php html search html-table edit