doulu2591 2014-07-09 12:19
浏览 117

“提交”按钮从表单元素转到URL

I'm trying to find a way to create a form with 2 fields. Username and Password. When the user clicks on submit it should take the username and password and add it to the URL in a specific place. For example: http://www.mydomain.com/cgi-bin/USERNAME=username_entered_in_form&PWD=password_entered_in_form

The URL will remain the same except for: "username_entered_in_form" should be replaced with the username and same with passowrd.

Then I would like for it to forward to another page.

Any help will be greatly appreciated

  • 写回答

2条回答 默认 最新

  • duan117890 2014-07-09 12:21
    关注

    create a form with GET method:

    <form method="GET" action="login.php">
        <input type="text" name="username" />
        <input type="password" name="pwd" />
    </form>
    

    Greetz

    Hint:

    Try to avoid sending sensible data via GET. For that reasons, better use the POST method:

    <form method="POST" action="login.php">
        <input type="text" name="username" />
        <input type="password" name="pwd" />
    </form>
    

    Using PHP as in my example, you retrieve the data with either:

    $_POST['username'] and $_POST['pwd']
    or
    $_GET['username'] and $_GET['pwd']
    

    for GET method

    评论

报告相同问题?

悬赏问题

  • ¥15 不同尺寸货物如何寻找合适的包装箱型谱
  • ¥15 求解 yolo算法问题
  • ¥15 虚拟机打包apk出现错误
  • ¥30 最小化遗憾贪心算法上界
  • ¥15 用visual studi code完成html页面
  • ¥15 聚类分析或者python进行数据分析
  • ¥15 三菱伺服电机按启动按钮有使能但不动作
  • ¥15 js,页面2返回页面1时定位进入的设备
  • ¥50 导入文件到网吧的电脑并且在重启之后不会被恢复
  • ¥15 (希望可以解决问题)ma和mb文件无法正常打开,打开后是空白,但是有正常内存占用,但可以在打开Maya应用程序后打开场景ma和mb格式。