在 Js 文件中,我動態(tài)創(chuàng)建表單。我沒有展示完整的文件,但它是由一組卡片組成的。然后在按下提交按鈕后到達的 php 文件上,我看不到 POST 變量。這很奇怪,因為我可以訪問 php,所以表單正在工作,但它沒有設置 post 變量。有人可以幫助我嗎?注意:我已經(jīng)嘗試過使用 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>";?>
在 Javascript 中動態(tài)創(chuàng)建表單無法在 PHP 上找到 POST 變量
紅糖糍粑
2022-07-08 16:15:42