简体   繁体   中英

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?

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

There are two ways to save data to server side in your case is PHP/MySQl

  1. using AJAX method
  2. Form method and used self method to get data in serverside.

I would suggest go for the ajax method.

  1. Apply form tag in your HTML
  2. Onsubmit capture submission, serialize for and send it through ajax and use it on PHP side.

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 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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