dongmi5607 2019-06-23 16:21
浏览 26
已采纳

如何在重定向的php文件中输出新表单?

I am trying to pass variables buy echoing new forms after using header("Location: location.php"). So when it is redirected, it outputs the form in the redirectred php file.

<?php

header("Location: location");
echo "<form><input type = 'submit' value ='try again' > </form>";
//expected output:the form outputs in the same files
?>
  • 写回答

2条回答 默认 最新

  • duanjia7912 2019-06-23 21:41
    关注

    Using header("Location:page") immediately exits your script and redirects the user to that page. However, I have successfully accomplished something very similar (to what I think you want) by scripting a Website Registration API.

    In total, I wrote 3 critical scripts, plus the original form page, in/out functions, and an assortment of data storage modules to create a seamless process. Your needs might not be as complicated as mine, but I found this to be much more involved than a simple 'validation check'.

    Basic outline:

    1. page original form is on: submit sends form data to script
    2. script parses incoming data and determines action
      • each input variable is parsed
        • if form data is empty: user is sent to original (blank) form page
        • if form data flags bad input: the form is reprinted (errors in red)
        • if form data is legit: data is stored; script advances to user portal
    3. login/logoff functions

    Try to solve your problem by thinking about each step of the process and breaking it down into bite-size pieces. (first you have to see the input, then you have to check the input, etc.)

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 PADS Logic 原理图
  • ¥15 PADS Logic 图标
  • ¥15 电脑和power bi环境都是英文如何将日期层次结构转换成英文
  • ¥20 气象站点数据求取中~
  • ¥15 如何获取APP内弹出的网址链接
  • ¥15 wifi 图标不见了 不知道怎么办 上不了网 变成小地球了