在 Js 文件中,我動態創建表單。我沒有展示完整的文件,但它是由一組卡片組成的。然后在按下提交按鈕后到達的 php 文件上,我看不到 POST 變量。這很奇怪,因為我可以訪問 php,因此表單可以正常工作,但它沒有設置 post 變量。有人能幫助我嗎?注意:我已經嘗試過使用 Ajax,但遇到了同樣的問題,到達頁面但沒有看到 post 變量集。Js文件 var f = document.createElement("form"); f.setAttribute("method","post"); f.setAttribute("action","../pages/show_negozio.php"); var i = document.createElement("input"); i.setAttribute("type","hidden"); i.setAttribute("value","'.$_SESSION['result_array'][$x+3].'"); i.setAttribute("name","email"); i.setAttribute("id","email'.$x.'"); var s = document.createElement("input"); s.className = ("btn btn-primary"); s.setAttribute("type","submit"); f.appendChild(i); f.appendChild(s); cardFooterDiv.appendChild(f);PHP文件<?php $name = $POST['email']; echo "<p>".$name."</p>";?>
- 2 回答
- 0 關注
- 138 瀏覽
添加回答
舉報
0/150
提交
取消