如何将两个选项值传递给PHP

时间:2013-04-16 23:01:19

标签: php option

以下是我目前拥有的代码,它正在努力传递week_num。我正在使用session_start()将我的变量从一个页面传递到另一个页面。

print'<form action="changeplayer_2.php" method="post">';

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>";

我很好奇的是我是否也可以将week_name传递到下一页。 请记住,我还是一个初学者,所以我很感激你能告诉我为什么/如何修复工作。

我试过了

print '<option value="'.$wrow['week_num,week_name'].'">'.'week '.$wrow['week_num'].'     '.$wrow['week_name'].'</option><br>\n';

print '<option value="'.$wrow['week_num','week_name'].'">'.'week '.$wrow['week_num'].'     '.$wrow['week_name'].'</option><br>\n';

两者都会产生错误

1 个答案:

答案 0 :(得分:1)

尝试这种连接:

print '<option value="'.$wrow['week_num'].'_'.$wrow['week_name'].'">'.'week '.$wrow['week_num'].'     '.$wrow['week_name'].'</option><br>\n';