Home > Backend Development > PHP Tutorial > php 怎么获取js的prompt里面的值

php 怎么获取js的prompt里面的值

WBOY
Release: 2016-06-13 12:02:32
Original
2004 people have browsed it

php 如何获取js的prompt里面的值
想用php 如何获取js的prompt里面的值,想着用隐藏表单来获取,可是不想设置提交按钮,要怎么提交数据,怎样改下面的代码,才能获取php 如何获取js的prompt里面的值,求解?
<script><br />var str=window.prompt('请输入修改主题', '');<br />document.getElemengById("content").value =str;<br /></script>




$content=$_POST["content"];
echo $content;
?>

------解决方案--------------------
次序错了!
虽然可以这么写,但并无使用价值。因为提交将产生新的 document
<?php<br />if($_POST) {<br />  $content=$_POST["content"];<br />  echo $content;<br />  exit;<br />}<br />?><br /><form id="form" action="" method="post"><br /><input type="hidden" name="content" id="content" value=""><br /></form><br /><script><br />var str=window.prompt('请输入修改主题', '');<br />document.getElementById("content").value =str;<br />document.getElementById("form").submit();<br /></script
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template