douoyou3348 2017-03-21 13:33
浏览 24
已采纳

如何将文本框的值复制到我的查询中

I have my textbox named Title here!

The Title is the upper most Textbox! I have a query where i should copy the value of that textbox which is 'A' to my query here

        $sql_query="SELECT * FROM tblpost WHERE Page = 'A' ";

this is exactly my code! Hope everyone can guide me because I am Actually new in PHP this is my whole code

        <form method="post">
        <div class="form-group">
      <label>Page Title</label>
      <input name="title" type="text"  value="<?php echo $fetched_row['Title']; ?>" required class="form-control" placeholder="Page Title">
    </div>
  <div class="form-group">
      <select class="form-control" name="active"  id="active">
          <option value="">~~SELECT~~</option>
          <option value="Actived">Activated</option>
          <option value="Deactivated">Deactivated</option>
        </select>
    </div>
    <div class="form-group">
      <label>Meta Tags</label>
      <input type="text"  value="<?php echo $fetched_row['Tags']; ?>" name="tags" required class="form-control" placeholder="Add Some Tags...">
    </div>
    <div class="form-group">
      <label>Category</label>
      <input type="text" name="description"  value="<?php echo $fetched_row['Description']; ?>" class="form-control" required placeholder="Add Category...">
    </div>

         <table class="table table-striped table-hover" id="myTable">
                  <tr>
                    <th>Page Title</th>
                    <th>Status</th>
                    <th>Date Created</th>
                    <th></th>
                  </tr>

                         <?php



                        $sql_query="SELECT * FROM tblpost WHERE Page = //I think it's right here ";

                        $result_set=mysql_query($sql_query);
                        while($row=mysql_fetch_row($result_set))
                        {
                          ?>

                        <tr>
                            <td><?php echo $row[1]; ?></td>
                            <td><?php echo $row[3]; ?></td>
                            <td><?php echo $row[6]; ?></td>
                            <td><a class="btn btn-primary" href="javascript:edt_id('<?php echo $row[0]; ?>')">Edit</a>   <a class="btn btn-danger" href="javascript:delete_id('<?php echo $row[0]; ?>')">Delete</a></td>      
                          </tr>
                            <?php
                     }
                     ?>

                          <script>
                          function myFunction() {
                            var input, filter, table, tr, td, i;
                            input = document.getElementById("myInput");
                            filter = input.value.toUpperCase();
                            table = document.getElementById("myTable");
                            tr = table.getElementsByTagName("tr");
                            for (i = 0; i < tr.length; i++) {
                              td = tr[i].getElementsByTagName("td")[0];
                              if (td) {
                                if (td.innerHTML.toUpperCase().indexOf(filter) > -1) {
                                  tr[i].style.display = "";
                                } else {
                                  tr[i].style.display = "none";
                                }
                              }       
                            }
                          }
                          </script>


             </table>

           <center> <button type="submit" class="btn btn-primary" name="btn-update"><strong>UPDATE</strong></button> <button type="submit" class="btn btn-default" name="btn-cancel"><strong>Cancel</strong></button></center>

                 </form>
  • 写回答

4条回答

      报告相同问题?

      相关推荐 更多相似问题

      悬赏问题

      • ¥20 怎么将vs中的程序同步到sql中的表中
      • ¥15 用flask框架接收前端上传的文本文件后怎么读取该文件
      • ¥15 有没有嵌入式ubuntu的朋友
      • ¥50 diddler Burp Suite
      • ¥20 关于UE5.1的问题,求专家解答!
      • ¥30 关于#爬虫#的问题:百度为您找到相关结果约100,000,000个 但只展现70页 有没有可能提取出来全部的搜索结果
      • ¥40 IIS部署API,弄了几天没弄出来,希望带佬远程帮我弄一下,有偿
      • ¥15 关于#c##的问题:winform中利用delegate更新ui的顺序错误
      • ¥15 qt5.6.1读取oracle8中文数据乱码
      • ¥15 matlab支持向量机预测部分遇到了问题