Home>
We need to implement deleting data without reloading the page, please tell me how to send the record ID to the func_admin.php file in order for the script to work:
if (isset($_POST['delete_id'])) {
$delid= $_POST['delete_id'];
$sqldelttech= ("DELETE FROM `spravtech` WHERE `spravtech`.`id_spravtech`= ?");
$quwerydel= $db->prepare($sqldelttech);
$quwerydel->execute([$delid]);
}
Table markup:
<div class="container-fluid" style="margin-top: 20px;"> <table class="table table-sm table-bordered table-hover" style="font-size: 12px;"> <thead class="table-secondary"> <tr> <th>No.</th> <th>ATS</th> <th>DIVISION</th> <th>TECHNICAL TYPE</th> <th>MANUFACTURER</th> <th>MODEL</th> <th>SERIAL NUMBER</th> <th>PART NUMBER</th> <th>COMMISSIONING</th> <th>ACTION</th> </tr> </thead> <tbody class="table-light"> <?php if (!empty($restechinfo)) {
foreach ($restechinfo as $resinfo) { ?> <tr> <td><?php echo $resinfo->id_spravtech; ?></td> <td><a href="#"><?php echo $resinfo->name_ovdrb; ?></a></td> <td style="max-width: 150px;"><?php echo $resinfo->name_subdivision; ?></td> <td><?php echo $resinfo->type; ?></td> <td><?php echo $resinfo->manufacture; ?></td> <td><?php echo $resinfo->model; ?></td> <td><?php echo $resinfo->serial_number; ?></td> <td><?php echo $resinfo->inventory_number; ?></td> <td><?php echo $resinfo->date; ?></td> <td> <div class="bttnaction"> <div class="bttnactiongroup"> <a id="delete_id<?php echo $resinfo->id_spravtech; ?>" onclick="return confirm('Are you sure you want to delete record no. <?php echo $resinfo->id_spravtech; ?>?')" class="btn btn-danger btn-sm"> <i class="fa fa-trash"></i> </a> </div> </div> </td> </tr> <?php } ?> <?php } else { ?> <tr> <td colspan=10 class="text-center table-danger">NO DATA</td> </tr> <?php } ?> </tbody> </table> </div>
If it seems, then please google it and throw off the link as an answer, I didn’t ask a question in order to see witty comments like: "google for help", there is no desire to help, you can just scroll through the question, why did you write this?
Bastard_Ape2022-01-18 05:49:03Related questions
- javascript : Output and immediately insert data into the database
- javascript : Persistent open tabs
- javascript : AJAX requests, JS and PHP [duplicate]
- javascript : PHP code initializes variable all over again and over again
- javascript : Launching Fortnite or games from EpicGames via the link
- javascript : How to set an event to beep
- javascript : Repeated GET request to the image when flipping the slider in the firefox browser
- javascript : js code execution protection
- javascript : How can I transfer Recaptcha v2 for solution to another person
- javascript : $("#element").va() returns an empty string, but if this is written in the console (ctrl+shift+i), then the correct
it seems to me that if you google ajax, the answer will be in the first billion results
Artem Gorlachev2022-01-18 05:41:48