仍在敲我的头,但我认为答案可能会帮助我了解事情的真正运作方式。我一直很讨厌语言,但我想在你的帮助下,我可以强行做到这一点。
因此,我将发布整个代码,以免引起混淆。
<html>
<head>
<title>Change a player</title>
</head>
<BODY >
<?php
include "inc.php";
session_start();
print 'Select week for season: ';
print $this_season;
##the week drop down query#
$wquery=
"select week_num,week_name
from stats_week
where season=$this_season
order by week_num";
$wresult=mysql_query($wquery);
print'<form action="changeplayer_2.php" method="post">';
session_start();
print"<select name='Week_select'> <br>";
while ($wrow=mysql_fetch_array($wresult))
{
print '<option value="'.$wrow['week_num'].'">'.'week '.$wrow['week_num'].' '.$wrow['week_name'].'</option><br>\n';
}
print "</select><br><br>";#
print'<button type="submit" >Next</button>';
$varWeek=$_POST['Week_select'];
print"</form>";
$_SESSION['week'] = $varWeek;
?>
</body>
</html>
所以,我不知道如何将 'Week_select' 分配给 $_SESSION['week']。上面的代码是我最后的努力。其次,一旦我为 Session 分配了一些东西,我以后如何清除它,这样它就不会一直弹出?奖金问题
print 'Select week for season: ';
print $this_season;
是我可以同时显示语句和变量的唯一方法。当我做
print 'Select week for season: '$this_season;
我没有显示变量,当我这样做时
print 'Select week for season: $this_season';
我得到 Select week for season: $this_season 显示