JoeSarayuth 0 Newbie Poster

i have start learning Bootstrap to design my first Searching Website and i use dropdown list for filter topic what user need to search and input text box for key word (like this pic http://upic.me/i/zl/9aaaa.jpg)
This below is my code

<!-- Search Container-->
       <div class="container" id="searchBar">
        <div class="row">    
          <div class="col-xs-8 col-xs-offset-2">
            <form method="post" action="<?php echo $_SERVER['SCRIPT_NAME'];?>">
              <div class="input-group" >
                <div class="input-group-btn search-panel">
                  <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
                      <span id="search_concept">Filter by</span> <span class="caret"></span>
                  </button>
                    <ul class="dropdown-menu" role="menu">
                      <li><a href="#is_name">IS's Name</a></li>
                      <li><a href="#student_name">Student's Name</a></li>
                      <li><a href="#reacher_name">Teacher's Name</a></li>
                      <li><a href="#department">Department</a></li>
                      <li><a href="#semester">Semester</a></li>
                      <li class="divider"></li>
                     <li><a href="#all">All</a></li>
                    </ul>

                </div>
                <!-- <input type="hidden" name="search_param" value="all" id="search_param">          -->
                <input name="txtSearch" type="text" class="form-control" id="txtSearch" placeholder="Search term..." 
                value="<?php echo $wordSearch;?>">
                <span class="input-group-btn">
                <button id="btnSearch" class="btn btn-default" type="submit"> 
                  <span class="glyphicon glyphicon-search"></span></button>
                </span>
              </div>
          </form>
        </div>

               <?php
                    $serverName = "JOKUTO-PC";
                    $uid = "sa";
                    $pwd = "1234";
                    $connectionInfo = array( "UID"=>$uid,"PWD"=>$pwd,"Database"=>"Nida");
                    /* Connect using SQL Server Authentication.*/
                    $conn = sqlsrv_connect( $serverName, $connectionInfo);

                      if( $conn === false )
                      {
                        echo "Unable to connect.</br>";
                        die( print_r( sqlsrv_errors(), true));
                      }

                      $sql = "SELECT * FROM document WHERE doc_id LIKE '%".$wordSearch."%' ";
                      $query = sqlsrv_query($conn, $sql); 
                      if($query === false) {
                        die( print_r( sqlsrv_errors(), true) );
                        }

               ?>


               <?php
                if($result = sqlsrv_fetch_array($query, SQLSRV_FETCH_ASSOC))
                {

                  echo $result["doc_id"];
                  echo "      ";
                  echo $result["comment"];
                  echo "      ";
                  echo $result["s_id"];
                  echo "<br>";


                }
              ?>

            </div>
          </div><br><br>
        <!-- /.Search container -->
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.