实现php读取mysql数据库,将值返回给html的button
实现效果

代码
<?php
$host = '127.0.0.1';
$user = 'root';
$password = '123456';
$dbName='yzmm';
$link = new mysqli($host,$user,$password,$dbName);
if($link->connect_error){
die("连接失败: ".$link->connect_error);
}
else{
echo "success!
";
}
$sql = "select *from TestButton";
$res = $link->query($sql);
$data = $res->fetch_all();
foreach($data as $value)
{
echo $value[0]." , ". $value[1]."
";
}
?>
<title>无标题文档</title>
<style type="text/css">
.td1 {
height: 100px;
width: =100px;
}
.link1 {
font-family: Cambria, "Hoefler Text", "Liberation Serif", Times, "Times New Roman", serif;
padding-top: 50px;
padding-right: 100px;
padding-bottom: 50px;
padding-left: 50px;
}
.Hyperlinks {
padding-right: 20px;
padding-bottom: 20px;
}
.box {
padding-top: 20px;
border:solid;
width: 200px;
height: 200px;
}
</style>
</head>
<body>
<table width="1920" border="1">
<tbody>
<tr >
<td width="270" class="td1"><img src="yzmmlogo.png" alt="" width="182" height="57" align="middle"/></td>
<td class=link1 width="1334"> <a class="Hyperlinks" href="yhgl.html">网络配置</a> <a class="Hyperlinks" href="yhgl.html">用户管理</a> <a class="Hyperlinks" href="dsgl.html">对时管理</a> <a class="Hyperlinks" href="bz.html">帮助</a></td>
</tr>
<tr>
<td rowspan="2"></td>
<td height="724"><div class="box">基本配置</div></td>
</tr>
<tr>
<td><p>
<input type="button" name="button1" id="button1" value=$value[1]>
<input type="button" name="button2" id="button2" value="高级配置">
<input type="button" name="button3" id="button3" value="运维管理">
<input type="button" name="button4" id="button4" value="运维监控">
<input type="button" name="button5" id="button5" value="故障诊断">
<input type="button" name="button6" id="button6" value="软件管理">
<input type="button" name="button7" id="button7" value="信息采集">
</p></td>
</tr>
</tbody>
</table>
</body>
</html>
如果能提供实现思路,是非常感谢大家的。