嘿伙计们,我很难发送属于刚刚被点击的 $row['projectnaam'] 的会话变量。目前 Session 总是从 while 循环中获取最后一个 $row['projectnaam'] ,我想知道如何使用属于刚刚单击的行的会话发送正确的变量。
先感谢您。
这是我的语法:
<?php
include "config.php"
$bedrijfsnaam = $_SESSION['gebruikerbedrijf'];
$result= mysql_query("SELECT * FROM projecten WHERE bedrijfsnaam='$bedrijfsnaam' ")or die(mysql_error());
while($row = mysql_fetch_array($result)){
if (isset($_POST['submit'])){
$_SESSION['projectnaam'] = $projectnaam;
header('Location: viewprojectsbedrijf.php');
}
echo "<div class='project'>";
echo "<div class='projectdetails'>";
echo "<p class='projectnaam'>";
echo $row['projectnaam'];
echo "</p>";
echo "<hr class='paars'>";
echo "<p class='datum'>";
echo $row['datum'];
echo "|";
echo $row['Tijd'];
echo "</p>";
echo "<hr class='paars'>";
echo "<p class='bedrijfsnaam'>";
echo $row['bedrijfsnaam'];
echo "</p>";
echo "</div>";
echo "<div class='view'>";
echo "<form method=\"POST\" action=\"\">";
echo "<input type='submit' value='View' name='submit' class='viewbutton'></input>";
echo "</form>";
echo "</div>";
}
?>