【发布时间】:2015-03-11 04:25:52
【问题描述】:
这是我用来将数据发布到gamelobby.php的表单
<form id="game_form" method="POST" action="/gamelobby.php">
<input type="text" id="plr_name"></input>
<input type="hidden" value="" id="table_name"></input>
</form>
<button id="codefight_create">Create a Fight</button>
这是提交表单的函数
function codefight_create(){
// blah blah, some ajax
table_name = xmlhttp.responseText;
document.getElementById("table_name").value = table_name;
document.getElementById("game_form").submit();
// console.log(table_name);
}
document.getElementById("codefight_create").addEventListener("click", function(){
codefight_create();
});
问题是,当我在gamelobby.php页面上var_dump($_POST)时,页面上的$_POST超全局中没有存储数据。
【问题讨论】:
-
你能发布一些 ajax 等等吗?我怀疑这部分的问题
-
不是,
table_name变量正是它应该的样子。