起初,我有一个redirect.php,它允许我将所有信息附加到链接,并使用标题将用户发送到他们的页面。
然而,我想知道是否有可能将此表单数据发送到同一页面并同时显示用户页面。
我希望我有道理。非常感谢。
解决方案如果理解你的问题可以用很多方法完成,例如使用基于函数的填充。 一种方法是检查表单是否使用 $ _ POST 发布,或者检查隐藏字段$ _POST ['_ submit']。这看起来很乱,但显示基本的方式。
<?php if(!isset($ _ POST ['_ submit '])){?> < form action =post.phpmethod =post> < input type =submit/> < input name =somevaluetype =text/> < input name =_ submittype =hiddenvalue =_ submit/> < / form> <?php } else { echo htmlspecialchars($ _ POST ['somevalue']); ?> < em>< / em> <?php}? >您还需要做其他事情来使代码生成准备就绪,如uisng isset 在您检查的字段上,否则如果有人篡改表单,您将失去通知
I have a rather complicated situation. Right now I have a form on a page that asks for my visitor's information. I have a script that allows me to take the visitors information and append it to a link.
At first, I had a redirect.php that allowed me to append all the information to the link and used a header to send the user to their page.
However, I was wondering if it is possible to send this form data into the same page AND display the users page at the same time.
I'm hoping I make sense. Thanks a lot.
解决方案this if understand your question can be done many ways, eg using function based fillers. One way is to check if the form has been posted using $_POST or by checking for a hidden field $_POST['_submit']. this looks messy but shows basic way.
<?php if (!isset($_POST['_submit'])) { ?> <form action="post.php" method="post"> <input type="submit" /> <input name="somevalue" type="text" /> <input name="_submit" type="hidden" value="_submit" /> </form> <?php } else { echo htmlspecialchars($_POST['somevalue']); ?> <em></em> <?php } ? >There are other things that you would still need to do to make this code production ready like uisng isset on fields your checking against else you will have losts of notices if people tamper with the form
更多推荐
通过表单将POST数据传递到同一页面上
发布评论