【发布时间】:2016-05-17 06:33:56
【问题描述】:
我有一个想法,想知道它是否可以在 PHP 上,因为我是 PHP 新手。我需要 ping 选定的计算机名称或 IP 地址,并在 ping 状态框中将状态显示为在线或离线。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8">
<title>Books</title>
</head>
<body>
<form action="Untitled-1.php" method="post">
<input type="text" name="search"/>
<input type="submit" value="search"/>
<input type="button"value="ping"/>
</form>
</form>
<br/>
<table border="1">
<thead>
<tr>
<th>username</th>
<th>desktop</th>
<th>ip address</th>
<th>select pc's</th>
<th>ping status</th>
</tr>
</thead>
<?php
include("db.php");
$word = isset ($_POST['search']) ? $_POST['search'] : "";
$result=mysql_query("SELECT * FROM pc WHERE desktop like '%$word%'");
while($test = mysql_fetch_array($result)) {
$id = $test['user_id'];
?>
<tr align='center'>
<td><font color='black'><?php echo $test['username'] ?></font></td>
<td><font color='black'><?php echo $test['desktop'] ?> </font></td>
<td><font color='black'><?php echo $test['ip_address'] ?></font></td>
<td><input name="selector[]" type="checkbox" value="<?php echo $id; ?>"></td>
<td><font color='black'><?php echo $test['ping_status'] ?></font></td>
</tr>
<?php
}
?>
</table>
</body>
</html>
请帮忙
【问题讨论】:
标签: php select checkbox mysqli ping