爲什麼下一個代碼不能將「遊戲」作爲數組傳遞給php?HTML表單不通過複選框
<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>
我在螢火蟲檢查,似乎創造一個正確的形式,直到提交,那麼它只是不通過複選框陣列。
您能否包含呈現的表單HTML樣本? – 2011-05-10 17:49:45