简体   繁体   English

如何在mysqli和php中保存bootstrap 2或3导航选项卡内容?

[英]How to save bootstrap 2 or 3 nav tabs content in mysqli and php?

I have write the bootstrap nav tabs and some of information in write each and every tabs and how to save each and every tab how the information will save in the mysqli? 我已经写了引导nav选项卡,并在写每个选项卡中包含了一些信息,以及如何保存每个选项卡中的信息将如何保存在mysqli中?

I have already try but not working this is my code show 我已经尝试过但不能正常工作,这是我的代码展示

<!-- 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);

This is actually i have write code in this 3 navs I have written each nav tabs there is addrows are there each tab I wrote the code for insert each and every tab content value but there is not inserted 这实际上是我在这3个导航中编写的代码,我已经编写了每个导航选项卡,并且有addrows,在每个选项卡中我都编写了用于插入每个选项卡内容值的代码,但是没有插入

There are two ways to save data to server side in your case is PHP/MySQl 在您的情况下,有两种方法可以将数据保存到服务器端:PHP / MySQl

  1. using AJAX method 使用AJAX方法
  2. Form method and used self method to get data in serverside. Form方法和使用self方法在服务器端获取数据。

I would suggest go for the ajax method. 我建议去使用ajax方法。

  1. Apply form tag in your HTML 在HTML中套用表格标记
  2. Onsubmit capture submission, serialize for and send it through ajax and use it on PHP side. Onsubmit捕获提交,序列化并通过ajax发送,并在PHP端使用。

Read this full thread. 阅读此完整主题。

https://stackoverflow.com/questions/6784599/passing-form-data-to-mysql-through-ajax

First of all you can create a table for a page then after you can write your queries and update your database values to that one also 首先,您可以为页面创建一个表,然后可以编写查询并将数据库值更新为该表

for example i will create a table for your page 例如,我将为您的页面创建一个表格

look like this 看起来像这样

$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 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM