dimanche 16 avril 2017

in admin panel when i click on checkbox user panel show the value of checkbox. how can i do it using mysql and php

Here only one can be click. in admin panel when i click on buy checkbox it will display the value of checkbox in user panel. and when i click on sell checkbox it will display the value of checkbox in user panel.i want to show product name , buy value , sell value and date in user panel. how can i do it using mysql and php.

my database name is mydb. table name product and its column name are id, product , buy , sell , date .

here is Admin panel

<script src="http://ift.tt/1oMJErh"></script>

    <script>
      $(function() {
        $("input:checkbox").on('click', function() {
          // in the handler, 'this' refers to the box clicked on
          var $box = $(this);
          if ($box.is(":checked")) {
            // the name of the box is retrieved using the .attr() method
            // as it is assumed and expected to be immutable
            var group = "input:checkbox[name='" + $box.attr("name") + "']";
            // the checked state of the group/box on the other hand will change
            // and the current value is retrieved using .prop() method
            $(group).prop("checked", false);
            $box.prop("checked", true);
          } else {
            $box.prop("checked", false);
          }
        });
      });
    </script>
    
      <table >
       <form action ="" method ="post">
         <thead>
                <tr>
                   <th>Product Nane</th>
               <th>Buy</th>
               <th>Sell</th>
               <th>Date</th>
             </tr>
         </thead>
              <tr>
                        <td>abc</td>
                  <td><input type="checkbox" name="mobil[1][]"  value="buy"></td>
                 <td><input type="checkbox" name="mobil[1][]"  value="sell"></td>
                    <td> <?php echo date("Y-m-d H:i:s")?> </td>
                </tr>
            
              <tr>
                        <td>usd</td>
                <td><input type="checkbox" name="mobil[2][]" value="buy"></td>
                <td><input type="checkbox" name="mobil[2][]"  value="sell"></td>
                    <td><?php echo date("Y-m-d H:i:s")?> </td>
              </tr>
            <tr>
                  <td>bfg</td>
              <td><input type="checkbox" name="mobil[3][]"  value="buy"></td>                 
              <td><input type="checkbox" name="mobil[3][]"  value="sell" ></td>
               <td><?php echo date("Y-m-d H:i:s")?> </td>
                </tr>
             <tr>
                    <td></td>
                 <td><input type="submit" name="Submit" value="Submit"></td>
             </tr>
        </form>
    </table>

Aucun commentaire:

Enregistrer un commentaire