dtnwm4807 2016-05-10 06:31
浏览 35

注册表单功能与搜索表单重叠

I have been having problems with my forms in php, i have a search form and a register form, but whenever i include the header.php where the search form is in the same page as the register form, the register form requires that the search textbox should also be filled out....please help...thanks in advance... Here is where search form is:

<?php //header.php

echo "<header class='top' role='header'>
     <div class='container head' style='padding:0 !important;'>
        <nav class='navbar navbar-default' style='margin-bottom:0px;'>
            <div class='container-fluid' style='background-color:white;'>

                <div class='navbar-header'>
                    <button type='button' class='navbar-toggle collapsed'           data-toggle='collapse' data-target='#bs-example-navbar-collapse-1' aria-expanded='false'>
                        <span class='sr-only'>
                            Toggle navigation
                        </span>
                        <span class='icon-bar'>
                        </span>
                        <span class='icon-bar'>
                        </span>
                        <span class='icon-bar'>
                        </span>
                    </button>

                    <a class='navbar-brand' href=''>
                        <img id='logo' class='logo' name='logo' src='../images/euLogo.png' />
                    </a>
                </div>

                <div class='collapse navbar-collapse' id='bs-example-navbar-collapse-1'>                        
                    <form class='navbar-form navbar-left frm-search' role='search'>
                        <div class='form-group'>
                            <input type='text' class='form-control' placeholder='Search' />
                        </div>

                        <button type='submit' class='btn btn-info'>
                            <span class='glyphicon glyphicon-search'>
                            </span>
                        </button>
                    </form>

                    <ul class='nav navbar-nav navbar-right'>
                        <li>
                            <a href=''><img id='btn-credits' class='btn-credits' name='btn-credits' src='../images/piggybank.png' />
                            </a>
                        </li>
                        <li>
                            <a href='https://www.facebook.com/uniteenglish/?fref=ts'>
                                <img id='btn-FBLike' name='btn-FBLike' class='btn-FBLike' src='../images/like.png' />
                            </a>
                        </li>
                        <li class='dropdown'>
                            <a href='' class='dropdown-toggle' data-toggle='dropdown' role='button' aria-haspopup='true' aria-expanded='false'>
                                Welcome 
                                <label id='user-name' name='user-name' class='user-name'> 
                                </label> 
                                <span class='caret'>
                                </span>
                            </a>

                            <ul class='dropdown-menu'>
                                <li>
                                    <a href=''>
                                        My Account
                                    </a>
                                </li>
                                <li>
                                    <a href=''>
                                        My Credits
                                    </a>
                                </li>
                                <li>
                                    <a href=''>
                                        Something else here
                                    </a>
                                </li>
                                <li role='separator' class='divider'>
                                </li>
                                <li>
                                    <a href=''>
                                        Separated link
                                    </a>
                                </li>
                            </ul>
                        </li>
                    </ul>
                </div>
            </div>
        </nav>
    </div>
</header>";
?>

And the register.php:

<?php 
echo "<div class='container'>

<br/>

    <form action='registeruser.php' id='frm-register' name='frm-register' class='frm-register' method='POST'>

        <label>

            User name: 

        </label> 

        <input type='text' id='username' class='form-control frm' name='username' />

        <span class='errorMessage'>

        </span>

        <br/>

        <label>

            Email: 

        </label> 

        <input type='email' id='email' class='form-control frm' name='email' />

        <span class='errorMessage'>

        </span>

        <br/>

        <label>

            Confirm Email: 

        </label> 

        <input type='email' id='re_email' class='form-control frm' name='re_email' />

        <span class='errorMessage'>

        </span>

        <br/>

        <label>

            Password: 

        </label> 

        <input type='password' id='password' class='form-control frm' name='password' />

        <span class='errorMessage'>

        </span>

        <br/>

        <label>

            Confirm Password: 

        </label> 

        <input type='password' id='re_password' class='form-control frm' name='re_password' />

        <span class='errorMessage'>

        </span>

        <br/>

        <label>

            I am a: 

        </label> 

        <select id='iam' class='form-control frm' name='iam'>

            <option value='Teacher'>

                Teacher

            </option>

            <option value='Student'>

                Student

            </option>

            <option value='Parent'>

                Parent

            </option>

        </select>

        <br/>

        <label> 

            <input type='checkbox' id='agree' name='agree' class='check' value='I agree to terms and conditions and privacy policy.' /> 

            I agree to terms and conditions and privacy policy.

        </label>

        <br/>

        <br/>

        <label>

            Registration Type: 

        </label> 

        <input type='text' id='role' class='form-control frm' name='role' value='Member' readonly />

        <br/>

        <input type='submit' id='btn-register' class='form-control btn btn-danger frm' name='btn-register' value='Register Now' />

        <br/>

        <br/>

    </form>

</div>";

?>
  • 写回答

1条回答 默认 最新

  • dpoxk64080 2016-05-10 06:51
    关注

    I think your problem is that you are not assigning the minimun attributes for the search form and the register is making it required. Should be fixed like this:

    <form class='navbar-form navbar-left frm-search' role='search' name='search' method="post" action="yourfile.php">
      <div class='form-group'>
        <input type='text' class='form-control' placeholder='Search' />
      </div>
      <button type='submit' class='btn btn-info'>
        <span class='glyphicon glyphicon-search'></span>
      </button>
    </form>  
    

    This is a problem about identification, because the register form thinks that the search belongs to it.

    For further information and good practices I recommend you this post.

    Hope this helps you.

    评论

报告相同问题?

悬赏问题

  • ¥15 python的qt5界面
  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100