从代码中提取:
网页上看不到编辑按钮。不知道为什么?工作,我只添加[$ eventid]部分。删除它,它仍然无法正常工作。尝试使用其他浏览器但仍无法正常工作。
<div class="current events">
<h1>Your Current Events:</h1>
<?php
$sql = "SELECT * FROM events WHERE userid='{$_SESSION['u_id']}';";
$result = mysqli_query($conn, $sql);
if (mysqli_num_rows($result) > 0){
while ($row = mysqli_fetch_assoc($result)){
echo "<b>Event name: </b>";
echo " ";
echo $row['eventname'];
echo " ";
echo "<b>Event Venue: </b>";
echo " ";
echo $row['venue'];
echo " ";
echo "<b>Event Date: </b>";
echo " ";
echo $row['date'];
echo "<p></p>";
"
<form class='edit-btn' method='POST' action='editevent.php'>
<input type='hidden' name='eventname' value='" .$row['eventname']. "'>
<input type='hidden' name='venue' value='" .$row['venue']. "'>
<input type='hidden' name='date' value='" .$row['date']. "'>
<input type='hidden' name='name' value='" .$row['name']. "'>
<input type='hidden' name='eventid' value='" .$row['eventid']. "'>
<button>Edit</button>
</form>
";
}
}else{
echo "No Upcoming Events";
}
?>
</div>
答案 0 :(得分:2)
您忘了echo
表单内容。因为它在php中你必须echo
echo "
<form class='edit-btn' method='POST' action='editevent.php'>
<input type='hidden' name='eventname' value='" .$row['eventname']. "'>
<input type='hidden' name='venue' value='" .$row['venue']. "'>
<input type='hidden' name='date' value='" .$row['date']. "'>
<input type='hidden' name='name' value='" .$row['name']. "'>
<input type='hidden' name='eventid' value='" .$row['eventid']. "'>
<button>Edit</button>
</form>
";
答案 1 :(得分:0)
首先,在用双引号声明表单之前,包括“echo”。 对于按钮的情况,您可以尝试使用输入。 喜欢, 。 希望它能奏效。