好吧所以,大家好,我是PHP新手。添加一個「編輯」按鈕作爲第四列(Action)的第四個元素是有問題的,這是第四個。我需要在每本書名上添加一個編輯按鈕,並將用戶帶到編輯頁面,以便他們編輯書籍信息。 我不知道接下來要做什麼。我不知道如何添加按鈕,同時通過POST傳遞編輯請求。我應該改變什麼?如何嵌入HTML PHP在php中輸入標籤和表單標籤
內順便說一句,我使用的XAMPP和記事本+
感謝。
<?php
include('databaseConnection.php');
?>
<html>
<head>
<link rel="stylesheet" type="text/css" href="./css/librarySystem.css">
<title> Book List </title>
</head>
<div id="booklist_container">
<table id="booklist_table">
<?php
$select_all_books = "SELECT * FROM booklist";
$result = mysql_query($select_all_books);
echo "<tr>";
echo "<th>" ."Title". "</th>" ;
echo "<th>" ."Author". "</th>" ;
echo "<th>" ."ISBN" . "</th>" ;
echo "<th>" ."Action". "</th>";
echo "</tr>";
echo "<form method="POST" action="edit.php">" ;
while($row = mysql_fetch_array($result))
{
$authorVar = $row['Author'];
$titleVar = $row['Title'];
$ISBN = $row['ISBN'];
echo "<tr>";
echo "<td>" . $titleVar. "</td>";
echo "<td>" . $authorVar. "</td>";
echo "<td>" . $ISBN . "</td>";
echo"<input type="button" value="Edit Info">" ;
echo "</tr>";
} // end of while loop
echo "</form>" ;
?>
</table>
</div>
</html>
'echo「」;'使用這個http://php.net/manual/en/function.error-reporting.php會給你一個語法解析錯誤。 –
@ Fred-ii-你做了什麼?除了他的報價錯誤外,他還有幾個問題,我花了10分鐘爲他寫了一個非常有益的答案。 – Jason
@Jason好吧,那些其他的錯誤究竟是什麼?如果我錯過了什麼,我會重新打開它。 –