doushu5805 2013-09-26 11:25
浏览 96
已采纳

使用复选框将信息传递给下一个表单

I run a query

$querymail=mysql_query
("select sp.player_num as Pnum,concat(sp.first_name,' ',sp.last_name)as PName,
st.name as Team, sp.email_address as Email,spt_league_id as League, ss.Season_name
as Season from stats_player sp inner join stats_player_team stp,
stats_team st, stats_season ss 
where stp.player_num = sp.player_num and sp.email_address<>''
and st.team_num=stp.team_id and ss.season_index=stp.season_id and
ss.season_index=$this_season  order by st.name;");

and then output to a forum/table that has check boxes.

echo "<table border='1'>";
while($row=mysql_fetch_array($querymail))
{

echo "<tr><td><input type='checkbox' name='checkemail'
value=".$row'Pnum']."checked></td><td>".$row['PName']."</td><td>".$row['Email'].
"</td><td>".$row['Team'].' ' .$row['League'].' '.$row['Season']."</td></tr>";


}
echo "</table>";
echo "</form>";
}

It then send that info to a nother page to display info and then send to email addresses selected.

My query is good and the table displays correctly. I am unsure if I am actually gathering the correct information though via the check boxes. and that is where I need some help.

I want to collect sp.player_num of each checked item and pass to the next page. I will then do a lookup of the player num and email and set a email routine for that. but I can't seem to get anything to pass to next page.

I do a print_r($_POST) in emailall.ph but it returns empty.

Will I need to use Session_Start in this case?

展开全部

  • 写回答

1条回答 默认 最新

  • dongpiao0731 2013-09-26 11:30
    关注

    You need to have a opening form tag.

    echo "<form method='post' action='emailall.php'>";
    

    You need to make the checkbox an array, note the [] which was added to the name field.

    echo "<tr><td><input type='checkbox' name='checkemail[]'
    value='".$row['Pnum']."' checked></td><td>".$row['PName']."</td><td>".$row['Email'].
    "</td><td>".$row['Team'].' ' .$row['League'].' '.$row['Season']."</td></tr>";
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
编辑
预览

报告相同问题?

手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部