Vad*_*klk 1 html javascript php jquery
为什么下一个代码不将"游戏"作为数组传递给php?
<script type="text/javascript">
function buildAndSubmitForm(index){
<? $args = 't='.$team.'&s='.$season.'&l='.$league.'&f='.$flag;
$inputs = '';
foreach($games as $game)
$inputs .= '<input type="checkbox" name="games[]" id="games[]" value="'.$game.'" />';
?>
var form = '<?='<form name="myForm" id="myForm" action="scr'?>';
form = form.concat(index);
form = form.concat('<?='.php?'.$args.'" method="post">'.$inputs.'</form>'?>');
$('#formDiv').html(form);
$('#myForm').submit();
}
</script>
<div style="display: inline">
<div name="formDiv" id="formDiv" style="display: none;"></div>
<a href="#" onclick="buildAndSubmitForm('a')">Home Stats</a>
<a href="#" onclick="buildAndSubmitForm('b')">Visit Stats</a>
<a href="#" onclick="buildAndSubmitForm('c')">Wins VS Losses</a>
<a href="#" onclick="buildAndSubmitForm('d')">Home VS Visit</a>
<a href="#" onclick="buildAndSubmitForm('e')">Overall</a>
</div>
Run Code Online (Sandbox Code Playgroud)
我检查了firebug,它似乎创建了一个正确的表单,直到提交,然后它只是没有通过复选框数组.