dongyanpai2701 2013-08-05 14:15
浏览 52
已采纳

CSS按钮取消设置$ _POST

I downloaded a html with a CSS template. In the login form(where was initially placed the blue-button css works. I copied the same html code for button into another area and when I click on it doesn't work.

CSS

.blue-button {
    display: inline-block;
    vertical-align: top;
    border: solid 1px #6d8794;
    position: relative;
    border: solid 1px #6d8794;
    -moz-border-radius: 4px;
    -webkit-border-radius: 4px;
    border-radius: 4px;
    behavior: url(css/PIE.php);
}

.blue-button span {
    display: inline-block;
    vertical-align: top;
    border: solid 1px #6d8794;
    position: relative;
    border: solid 1px #a6bcc8;
    background: #85a3b3 url("../images/blue-button-stripes.gif") repeat-x left top;
    color: #fff;
    line-height: 26px;
    -moz-border-radius: 3px;
    -webkit-border-radius: 3px;
    border-radius: 3px;
    behavior: url(css/PIE.php);
}

.blue-button a, .blue-button input {
    border: 0px;
    padding: 0px 15px;
    height: 26px;
    color: #fff;
    font-weight: bold;
    font-size: 13px;
    font-family: Helvetica;
    text-shadow: 0px 1px #687b85;
    text-transform: uppercase;
    text-decoration: none;
    cursor: pointer;
    background: none;
}

.blue-button:hover a, .blue-button:hover input {
    text-decoration: underline;
}

PHP

public function ShowLoginPanel()
{    

 $this->LoginContent=
 '  <div class="column-1-3">
        <div class="white-box">

            <div class="box-content fixed-height">
                <form action="" method="post" class="contact-form">
                    <div>
                            <span class="blue-button"><span><input type="submit" value="SEND &raquo;" /></span></span>
                        </div>
                        <input type="hidden" name="val" value="checkin">
                    </div>
                </form>
            </div>
        </div>
    </div><!--/end .column-1-3 --> ';     

}

When I click the button, the $_POST["val"] is set but when I use the same code in another unit(instance registration.php)

     <div class="icon"><img src="images/register.png" alt="" /></div>
     <input type="hidden" name="val" value="registration">';    

the $_POST["val"] is unset and it doesn't do anything.

You can access my page from here http://tinyurl.com/pkw5wly In order to make a summary, my question is why in the loggin div the button works but in the registration div it doesn't work

  • 写回答

2条回答 默认 最新

  • doxqszx09742 2013-08-05 18:10
    关注

    You cannot access $_POST["val"] unless the form you are submitting has a method of post

    <form method="post" action="handler.php">
        <input name="val"/>
        <input type="submit"/>
    </form>
    

    Then you can access the $_POST variable

    echo $_POST["val"];
    

    Otherwise you can set method="get" (or not specify the method which very likely your case) and use the $_GET variable

    echo $_GET["val"];
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效
  • ¥15 悬赏!微信开发者工具报错,求帮改
  • ¥20 wireshark抓不到vlan
  • ¥20 关于#stm32#的问题:需要指导自动酸碱滴定仪的原理图程序代码及仿真
  • ¥20 设计一款异域新娘的视频相亲软件需要哪些技术支持