我想显示如下图像格式的数据,数据在数据库中,这是我检索数据的地方。
我想知道如何显示如下图所示的数据:
这是我的html表单代码:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>index</title>
<link href="newhtml.css" rel="stylesheet"/>
<script language="javascript" src="js/jquery-1.7.2.min.js"></script>
</head>
<body>
<form method="post" action="submitData.php">
<table class="Index" action="newhtml2.html">
<tr>
<td>
<div class="createAccount">CREATE ACCOUNT</div>
</td>
</tr>
<tr>
<td>
<input type="text" name="name" placeholder="bussiness name" class="textName" required/>
</td>
</tr>
<tr>
<td>
<textarea cols="17" rows="4" name="address" placeholder="bussines address" class="textAddress" required></textarea>
</td>
</tr>
<tr>
<td>
<textarea cols="17" rows="4" name="description" placeholder="post update information" class="postTxtArea" required></textarea>
</td>
</tr>
<tr>
<td>
<input type="email" name="email" placeholder="email address" class="textEmail" required/>
</td>
</tr>
<tr>
<td>
<input type="text" maxlength=10 name="mobilenumber" placeholder="mobile number" class="textMobile" required/>
</td>
</tr>
<tr>
<td>
<input type="submit" name="submit" value="Submit" class="primaryBtn" id="customId"/>
</td>
</tr>![data i want to display like the image link i gave][2]
</table>
</form>
</body>
</html>
答案 0 :(得分:0)
您必须首先使用PHP mysqli或PDO建立数据库连接。
然后触发查询并将结果存储在变量中,然后在查询包含值时运行循环。
<?php
mysqli_connect('','','','') //Set your parameters
$query="Your query";
$res=mysqli_query($query);
while($row=mysqli_fetch_array($res)){
echo "<table><tr><td>".$row['col_name']."</td></tr></table>";
}
根据您的表格添加您的数据库列表