Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 06/24/2023 in all areas

  1. There is a concept in design/engineering called Hysteresis. In a nut shell, you don't define hard cut-off points and instead define a range, or introduce a delay of some sort. So instead of having your code hide the menus when the container is <50 px from the top and show them when 50px or more from the top, you instead set it up such as: If container is <50 px from the top, hide the menus If container is >150px from the top, show the menus. If the container is between 50px and 150px from the top, just maintain whatever the current state is. The range can be fixed like the example, or dynamic by calculating the menu heights. You just need the range to be large enough that toggling the visibility of the menus doesn't cross both boundaries.
    1 point
  2. Sorry for my English, but to save time I had to use GT on some of my postings. Usually, I don't do that. Sometimes it works well, and sometimes it doesn't. I have read thru your code a couple of times, and I think I understand it. If I don't, please put me on the right track again. I am only a human and not a machine. The possibility of being wrong is there, and I'm not very good at this, but I try. I have not read thru the other answers in the thread, so sorry if I step on someone's toes. Shot in the blind.... From your code, it seems you are using checkboxes to select multiple items for deletion from a table. Right? However, you mentioned that only the first checkbox is working, even when you select the last checkbox. One issue I see with your code is that you are using the same name attribute for all the checkboxes, which means they will all have the same value when they are submitted. This could be causing the problem you are experiencing. To fix this issue, you need to give each checkbox a unique name attribute value that corresponds to the product ID for that particular item. You can do this by appending the product ID to the name attribute value of each checkbox using square brackets, like this: <input type='checkbox' name='check_list[<?= $prod_id ?>]' value='<?= $prod_id ?>' > In the above code, we are appending the product ID to the name attribute value of the checkbox using PHP. This will ensure that each checkbox has a unique name attribute value that corresponds to the product ID for that particular item. Then, in your PHP code, you can loop through the $_POST['check_list'] array to get the product IDs of the selected items, like this: if(!empty($_POST['check_list'])) { foreach($_POST['check_list'] as $prod_id) { // Delete the item with this product ID } } By doing this, you should be able to select multiple items for deletion using checkboxes and delete them successfully.
    1 point
This leaderboard is set to New York/GMT-04:00
×
×
  • 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.