php案列
<center>
<form id="form1" name="form1" method="post" action="">
<select name="select">
<option value="">请选择一个表</option>
<option>student</option>
<option>sc</option>
<option>course</option>
</select>
<input type="submit" name="Submit" value="确定" />
</form>
</center>
<?php
if (isset($_REQUEST["Submit"]))
{
$bm=$_REQUEST["select"];
$con=mysqli_connect('localhost','root','','stu'); //连接服务器
mysqli_query($con,"SET NAMES utf8");
$sql="select * from $bm";
$result=mysqli_query($con,$sql); //执行SQL语句
$row=mysqli_fetch_row($result);
echo "<table width='400' border='1' align='center' cellpadding='0'>";
echo "<tr>";
for ($i=0; $i<mysqli_num_fields($result); $i++)
echo "<td align='center' height='30'>".mysqli_fetch_field_direct($result,$i)->name."</td>";
echo "</tr>";
while($row)
{
echo "<tr>";
for ($i=0; $i<mysqli_num_fields($result); $i++)
echo "<td align='center' height='30'>".$row[$i]."</td>";
echo "</tr>";
$row=mysqli_fetch_row($result);
}
echo "</table>";
}
?>