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 随身WiFi网络灯亮但是没有网络,如何解决?
  • ¥15 gdf格式的脑电数据如何处理matlab
  • ¥20 重新写的代码替换了之后运行hbuliderx就这样了
  • ¥100 监控抖音用户作品更新可以微信公众号提醒
  • ¥15 UE5 如何可以不渲染HDRIBackdrop背景
  • ¥70 2048小游戏毕设项目
  • ¥20 mysql架构,按照姓名分表
  • ¥15 MATLAB实现区间[a,b]上的Gauss-Legendre积分
  • ¥15 delphi webbrowser组件网页下拉菜单自动选择问题
  • ¥15 linux驱动,linux应用,多线程