Jump to content

Recommended Posts

I'm trying to show my data under the toggle button according to the order_id. But i do not know why when i click on my toggle button it does not work. I do not know what is wrong with it. Any advice will be appreciated. 

  <?php
                   $dsql = "SELECT  o.order_id , o.purchase_price , o.order_datetime,  u.id, u.user_fullname ,  p.id, p.product_title , c.id , c.category, s.id , s.seller_fullname FROM ordered_items o INNER JOIN users u ON o.user_id = u.id INNER JOIN sellers s ON o.seller_id = s.id 
                      INNER JOIN products p ON o.product_id = p.id CROSS JOIN category c ON p.product_category = c.id WHERE category = '".$category."' ORDER BY o.order_id DESC";
                      $dquery = $conn->query($dsql);
                      $tot_orders = mysqli_num_rows($dquery);
                      if (!mysqli_num_rows($dquery)) {
                        echo '
                          <div class="col-12">
                            <div class="badge badge-danger">No Orders Found</div>
                          </div>
                        ';
                      } else {
                        while ($drow = $dquery->fetch_assoc()) {
                          ?>
                                <tr>
                                  <td>
                                    #<?php echo $drow['order_id']; ?>
                                  </td>
                                  <td>
                                    <?php echo $drow['user_fullname']; ?>
                                  </td>
                                  <td>
                                    RM<?php echo  number_format($drow['purchase_price'],2); ?>
                                  </td>
                                 
                                  <td class="text-center">  
                                  <a style="text-decoration: none;color: #000;" title="View Details" data-toggle="collapse" data-target="#products-details<?php echo $drow['order_id']; ?>">
                                  <i class="nc-icon nc-minimal-down" onclick="changeToggleIcon(this)"></i>
                              </a>  
                        </td>        
                                  </td>
                                </tr>
          
                             
                                

                        <?php   
                           $p_sql = "SELECT  o.order_id , o.purchase_price , o.order_datetime , o.quantity , o.quantity_unit, u.id, u.user_fullname ,  p.id, p.product_title , p.product_photo , c.id , c.category, s.id , s.seller_fullname FROM ordered_items o INNER JOIN users u ON o.user_id = u.id INNER JOIN sellers s ON o.seller_id = s.id 
                      INNER JOIN products p ON o.product_id = p.id CROSS JOIN category c ON p.product_category = c.id WHERE category = '".$category."'" ;
                        $p_query = $conn->query($p_sql);
                        while ($p_row = $p_query->fetch_assoc()) {
                      ?>      
                        <tr class="collapse" id="products-details<?php echo $drow['order_id']; ?>" >
                           <td style="border-top: none; font-size: 10px;">
                          <img src="https://dev.gopasar.today/images/product-main/<?php echo $p_row['product_photo']; ?>" style="height: 50px; width: 50px;">
                        </td>
                          <th style="border-top: none; font-size: 10px;">
                            
                            <?php echo $p_row['product_title']; ?>
                          </th>
                          <th style="border-top: none; font-size: 10px;">
                            Order Quantity :<?php echo $p_row['quantity']; ?><?php echo $p_row['quantity_unit']; ?>
                          </th>
                          <th style="border-top: none; font-size: 10px;">
                              RM   <?php echo $p_row['purchase_price'];?>
                             
                          </th>

                        </tr>
                        

                     
                    </div>
          
            </div>
          </div>
<?php
}
}
}

?>

 

Link to comment
https://forums.phpfreaks.com/topic/312513-toggle-button-does-not-work/
Share on other sites

No clue. I think this is a JavaScript problem, not a PHP problem. I see the following code with references to "toggle"

<a style="text-decoration: none;color: #000;" title="View Details" data-toggle="collapse" data-target="#products-details<?php echo $drow['order_id']; ?>"> <i class="nc-icon nc-minimal-down" onclick="changeToggleIcon(this)"></i> </a>

But, those are tags within nothing in them to be displayed to the user. Further the actual javascript functions are not in the above code. If this is indeed a javascript problem, then you shoudl post the HTML that is generated by the PHP code and be sure to include any javascript functions that are called by that code.

9 hours ago, sashavalentina said:

when i click on my toggle button it does not work

Here's an idea to try and get your head around ...   You cannot click on anything in PHP. 

PHP is a server-side technology so you can only get it do anything by sending it an HTTP request, by loading a URL, submitting a Form or sending it an AJAX request. 

Clicking is a client-side thing, usually supported by Javascript code that runs in your browser (and often sends AJAX requests under the covers).  
Fire up the "Developer Tools" in your favourite browser and step through the Javascript code as it runs. 

Regards, 
    Phill  W.

 

 

Edited by Phi11W
odd formatting
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.