首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何将引导2或3 nav选项卡内容保存在mysqli和php中?

如何将引导2或3 nav选项卡内容保存在mysqli和php中?
EN

Stack Overflow用户
提问于 2019-02-03 15:35:48
回答 2查看 379关注 0票数 0

我已经编写了引导导航选项卡和一些信息,在写每个选项卡和如何保存每个选项卡,如何将信息保存在mysqli中?

我已经试过了,但没有工作--这是我的代码展示

代码语言:javascript
复制
<!-- Material Purchase Div-->        
            <div class="row">
               <div class="col-lg-12">
                  <div class="card-box">
                     <h4 class="header-title m-t-0 m-b-30">Material Management</h4>
                     <ul class="nav nav-tabs">
                        <li class="nav-item">
                           <a href="#quote" data-toggle="tab" aria-expanded="true" class="nav-link active">
                           Quotes
                           </a>
                        </li>
                        <li class="nav-item">
                           <a href="#purchase" data-toggle="tab" aria-expanded="false" class="nav-link">
                           Purchases
                           </a>
                        </li>
                        <li class="nav-item">
                           <a href="#usage" data-toggle="tab" aria-expanded="false" class="nav-link">
                           Usage
                           </a>
                        </li>
                     </ul>
                     <div class="tab-content">
                        <div class="tab-pane fade show active" id="quote">
                           <i class="mdi mdi-plus"><button type="button" class='addmore'>Add More</button></i>
                           <form id='students' method='post' name='students' action='index.php'>

                              <table border="1" cellspacing="0" class="table-responsive">
                                <tr>
                                  <th><input class='check_all' type='checkbox' onclick="select_all()"/></th>
                                  <th>S.No</th>
                                  <th>Q.No</th>
                                  <th>Item Name</th>
                                  <th>Categories</th>
                                  <th>Brand</th>
                                  <th>Qty</th>
                                  <th>Rate</th>
                                  <th>Amount</th>
                                  <th>Quote Pic</th>
                                  <th>Others</th>
                                </tr>
                                <tr>
                                  <td><input type='checkbox' class='case'/></td>
                                  <td><span id='snum'>1</span></td>
                                  <td><span id='qnum'>1</span></td>
                                  <td><input type='text' id='item_name' name='item_name[]'/></td>
                                  <td><input type='text' id='categories' name='categories[]'/></td>
                                  <td><input type='text' id='brand' name='brand[]'/></td>
                                  <td width="10%"><input type='text' id='qty' name='qty[]'/> </td>
                                  <td width="10%"><input type='text' id='rate' name='rate[]'/></td>
                                  <td width="10%"><input type='text' id='amount' name='amount[]'/> </td>
                                  <td width="10%"><input type='text' id='qpic' name='qpic[]'/> </td>
                                  <td width="10%"><input type='text' id='others' name='others[]'/> </td>
                                </tr>
                              </table>

                              <button type="button" class='delete'>- Delete</button>

                              <p>
                        </div>
                        <!--Quotes Div Close-->
                        <div class="tab-pane fade" id="purchase">
                           <div class="row">
                              <div class="col-md-1">
                                 <div class="form-group">
                                    <label for="field-4" class="control-label">S.No</label>
                                    <input type="text" class="form-control" id="field-4" placeholder="1">
                                 </div>
                              </div>
                              <div class="col-md-1">
                                 <div class="form-group">
                                    <label for="field-4" class="control-label">Q.No</label>
                                    <input type="text" class="form-control" id="field-4" placeholder="1">
                                 </div>
                              </div>
                              <div class="col-md-1">
                                 <div class="form-group">
                                    <label for="field-4" class="control-label">Itemname</label>
                                    <input type="text" class="form-control" id="field-4" placeholder="Boston">
                                 </div>
                              </div>
                              <div class="col-md-2">
                                 <div class="form-group">
                                    <label for="field-5" class="control-label">Categories</label>
                                    <input type="text" class="form-control" id="field-5" placeholder="categories">
                                 </div>
                              </div>
                              <div class="col-md-1">
                                 <div class="form-group">
                                    <label for="field-6" class="control-label">Brand</label>
                                    <input type="text" name="country" id="autocomplete-ajax" class="form-control" autocomplete="off">
                                 </div>
                              </div>
                              <div class="col-md-1">
                                 <div class="form-group">
                                    <label for="field-4" class="control-label">Qty</label>
                                    <input type="text" class="form-control" id="field-4" placeholder="1">
                                 </div>
                              </div>
                              <div class="col-md-1">
                                 <div class="form-group">
                                    <label for="field-5" class="control-label">Rate</label>
                                    <input type="text" class="form-control" id="field-5" placeholder="1234.00">
                                 </div>
                              </div>
                              <div class="col-md-2">
                                 <div class="form-group">
                                    <label for="field-6" class="control-label">Amount</label>
                                    <input type="text" class="form-control" id="field-6" placeholder="123456">
                                 </div>
                              </div>
                              <div class="col-md-1">
                                 <div class="form-group">
                                    <label for="field-6" class="control-label">Inv. Pic</label>
                                    <input type="file" class="filestyle" data-input="false" data-buttonname="btn-secondary">
                                 </div>
                              </div>
                              <div class="col-md-1">
                                 <div class="form-group">
                                    <label for="field-6" class="control-label">Others</label>
                                    <input type="text" class="form-control" id="field-6" placeholder="123456">
                                 </div>
                              </div>
                           </div>
                           <!-- row-->       
                        </div>
                        <!-- Purchase Div Close-->
                        <div class="tab-pane fade" id="usage">
                           <div class="row">
                              <!-- Inline Form -->
                              <div class="col-md-12">
                                 <div class="card-box">
                                    <h4 class="m-t-0 header-title"></h4>
                                    <div class="row">
                                       <div class="col-md-1">
                                          <div class="form-group">
                                             <label for="field-4" class="control-label">S. No. </label>
                                             <input type="text" class="form-control" id="field-4" placeholder="1">
                                          </div>
                                       </div>
                                       <div class="col-md-4">
                                          <div class="form-group">
                                             <label for="field-5" class="control-label">Item Name </label>
                                             <input type="text" class="form-control" id="field-5" placeholder="Item Name">
                                          </div>
                                       </div>
                                       <div class="col-md-1">
                                          <div class="form-group">
                                             <label for="field-6" class="control-label">Qty</label>
                                             <input type="text" class="form-control" id="field-4" placeholder="1">
                                          </div>
                                       </div>
                                       <div class="col-md-6">
                                          <div class="form-group">
                                             <label for="field-6" class="control-label">Usage For </label>
                                             <textarea class="form-control" rows="5"></textarea>
                                          </div>
                                       </div>
                                    </div>
                                    <!--row-->
<button type="submit" name='submit' value='submit' class="btn btn-purple waves-effect waves-light pull-right">Submit</button>
                                 </div>
                                 <!--end card box-->
                              </div>
                              <!--end col-md-12-->
                           </div>
                           <!-- end row / End Inline form-->        
                        </div>
                        <!-- Usage Div-->
                     </div>
                     <!-- Tab Content-->
                  </div>
                  <!-- Close card-box -->
               </div>
               <!--col-lg-12-->
            </div>


mysqli code like this 



    $uinfo = "INSERT INTO `quotes`(`customer_name`, `customer_email`, `customer_mobile`, `customer_password`, 
        `customer_area`, `created_at`, `c_verify`, `status`) values ('$name','$email','$phone','$pass','$pin',now(),'$verification',0)";
            $uresult = $conn->query($uinfo);


            $uinfo = "INSERT INTO `purchase`(`customer_name`, `customer_email`, `customer_mobile`, `customer_password`, 
        `customer_area`, `created_at`, `c_verify`, `status`) values ('$name','$email','$phone','$pass','$pin',now(),'$verification',0)";
            $uresult = $conn->query($uinfo);

            $uinfo = "INSERT INTO `usage`(`customer_name`, `customer_email`, `customer_mobile`, `customer_password`, 
        `customer_area`, `created_at`, `c_verify`, `status`) values ('$name','$email','$phone','$pass','$pin',now(),'$verification',0)";
            $uresult = $conn->query($uinfo);

实际上,我已经在这三个导航中编写了代码,我编写了每个导航选项卡,每个选项卡都有加载项,每个选项卡都有我编写的插入每个选项卡内容值的代码,但是没有插入。

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2019-02-15 07:04:22

首先,您可以为页面创建一个表,然后在您编写查询并将数据库值更新到该查询之后。

例如,我将为您的页面创建一个表。

看上去像这样

代码语言:javascript
复制
$daily_reports = "INSERT INTO `daily_report`(`dr_id`,`mq_id`, `mp_id`, `mu_id`) VALUES (NULL,'$qid','$puid','$usage');


here $qid = Your Quotations id 
     $puid = your purchase id
     $usage = Your Usage id 
票数 1
EN

Stack Overflow用户

发布于 2019-02-03 15:46:28

有两种方法可以将数据保存到服务器端(在您的情况下是PHP/MySQl )

  1. 使用AJAX方法
  2. 表单方法和自方法在服务器端获取数据。

我建议采用ajax方法。

  1. 在HTML中应用表单标记
  2. Onsubmit捕获提交,序列化并通过ajax发送,并在PHP端使用它。

阅读这篇完整的文章。

代码语言:javascript
复制
https://stackoverflow.com/questions/6784599/passing-form-data-to-mysql-through-ajax
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/54504488

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档