所以我有三個頁面是索引頁。將索引頁中的表單數據寫入數據庫的一種方法。還有一個從數據庫中獲取數據,並用數據回顯出一個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