所以我有三个页面是索引页。将索引页中的表单数据写入数据库的一种方法。还有一个从数据库中获取数据,并用数据回显出一个html表格。如何从数据库中获取url
当前如果你在表格中写一个链接。它会以文本形式出现。我希望整个链接像<a href="[link]">[link]</a>
。
所以说,如果我写这到窗体:
看看这个:www.google.com 或看看这个:https://www.google.com
它会出来这样的HTML
看这个:<a href="www.google.com">www.google.com</a>
我怎么能这样做呢?
好了,所以在html是:
<form class="wide" action="Write-to.php" method="post">
<input class="wide" autocomplete="off" name="txt" type="text" id="usermsg" style="font-size:2.4vw;" value="" />
</form>
用户在其中会写:
“看看这个:www.google.com 或看看这个:https://www.google.com”
然后这将通过Write-to.php
发送到数据库。
$sql="INSERT INTO social (comunicate)
VALUES
('$_POST[txt]')";
}
这则被写入到数据库:
$result = mysqli_query($con,"(select * from social order by id desc limit {$limit_amt}) order by id asc");
while($row = mysqli_fetch_array($result))
{
echo "<tr div id='".$i."' class='border_bottom'>";
echo "<th scope='col'>";
echo "<span class='text'>".htmlspecialchars($row['comunicate'])."</span><br />";
echo "</th>";
echo "</tr>";
}
您可以发布您关于呼应URL编码? – Fabio
这只是使用mysqli'mysqli_fetch_array'的标准方式# – maxisme
为什么downvote? – maxisme