HTML表单 - 当URL包含index.aspx时,输入类型提交问题,action = URL [英] HTML forms - input type submit problem with action=URL when URL contains index.aspx

查看:197
本文介绍了HTML表单 - 当URL包含index.aspx时,输入类型提交问题,action = URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个HTML表单,它在?之后截断动作参数mark - 这不是我期望的行为。



以下是一个具有代表性的HTML代码片段:

 < form action =http://spufalcons.com/index.aspx?tab=gymnastics&path=gym> 
< input type =submitvalue =SPU Gymnastics/>
< / form>

在这种情况下,submit按钮会将您带到 http://www.spufalcons.com/index.aspx 页面,有效地忽略?tab = gymnastics& path = gym参数。看起来action = URL中引用的所有HTML和PHP页面都按预期工作。这种行为在所有主流浏览器(IE,FF,Safari,Chrome,Opera)中都是一致的。



有没有人看过这个问题?或者可以建议与我的纯粹CSS / HTML / PHP网站开发方法一致的替代方案和/或解决方法?我试图用HTML实体值替换特殊字符而没有影响。我真的不想使用JavaScript或按钮PNG或图像地图放弃我的CSS样式的提交按钮。



环境:




  • Web服务器:Apache 2.2.14

  • PHP:5.2.10

  • < Mac OS X 10.5.8
  • HTML文档信息:
  • <!DOCTYPE html PUBLIC - // W3C / / DTD XHTML 1.0 Transitional // EN

    http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional。 dtd>

    < html xmlns =http://www.w3.org/1999/xhtml>

    TIA -
    Trent


  • 解决方案

    将查询参数置于隐藏的输入字段中:

     < form action =http: //spufalcons.com/index.aspx\"> 
    < input type =hiddenname =tabvalue =gymnastics/>
    < input type =hiddenname =pathvalue =gym/>
    < input type =submitvalue =SPU Gymnastics/>
    < / form>


    I have a HTML form that truncates the action parameter after the "?" mark - which is NOT the desired behavior I am looking for.

    Here is a representative HTML snippet:

    <form action="http://spufalcons.com/index.aspx?tab=gymnastics&path=gym">
        <input type="submit" value="SPU Gymnastics"/>
    </form>
    

    In this case, the submit button takes you to the "http://www.spufalcons.com/index.aspx" page, effectively ignoring "?tab=gymnastics&path=gym" parameter. It appears that all HTML and PHP pages referenced in the action=URL work as expected. This behavior is consistent across all major browsers (IE, FF, Safari, Chrome, Opera).

    Has anyone seen this problem before? Or can suggest an alternative and/or workaround consistent with my "pure" CSS/HTML/PHP web development approach? I have tried replacing the special characters with HTML entity values with no impact. I REALLY don't want to use abandon my CSS-styled submit buttons by using Javascript or button PNG's or image maps.

    Environment:

    • Web Server: Apache 2.2.14
    • PHP: 5.2.10
    • OS: Mac OS X 10.5.8
    • HTML document info:
    • <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <html xmlns="http://www.w3.org/1999/xhtml">

    TIA -- Trent

    解决方案

    Put the query arguments in hidden input fields:

    <form action="http://spufalcons.com/index.aspx">
        <input type="hidden" name="tab" value="gymnastics" />
        <input type="hidden" name="path" value="gym" />
        <input type="submit" value="SPU Gymnastics"/>
    </form>
    

    这篇关于HTML表单 - 当URL包含index.aspx时,输入类型提交问题,action = URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆