3
I have a table:
The information shown is searched in the bank, and on the column side (in this example) - Salary - you will have a column called Lock / Unlock - where I can block that information in the bank (changing the value from 0 to 1) and so before the name - example Ashton Cox will have a green icon that means unlocked and a red one if it is locked.
By marking the checkbox, I wanted an Alert to appear "Are you sure you want to block?" and the same thing to unlock "Are you sure you want to unlock?"
Like I’m doing:
<tbody>
<?php
while($linhaAssociativa = mysqli_fetch_assoc($query))
{ ?>
<tr>
<td><?php echo $linhaAssociativa["Name"]; ?></td>
<td><?php echo $linhaAssociativa["Position"]?></td>
<td><?php echo $linhaAssociativa["Office"]?></td>
<td><?php echo $linhaAssociativa["Age"]?></td>
<td><?php echo $linhaAssociativa["Start date"]?></td>
<td><?php echo $linhaAssociativa["Salary"]?></td>
<td><input type="checkbox" name="muda" id="muda" /></td>
</tr>
<?php
} ?>
</tbody>
I’m not able to do javascript/jquery code for that: when checking a checkbox of such a row of the table show if it is not locked: "Are you sure you want to block?" or show if locked: "Are you sure you want to unlock?" - on an Alert and change the value from 0 to 1 or 1 to 0
Create an expensive JS file to do this, so you will be able to capture the action of clicking on the checkbox and change from locked to unlocked and vice versa .
– Ricardo Lucas
Have you ever done any script ?
– Marco Souza
I edited my question and put in bold what my real question is. @Dotnet I haven’t made any script yet. What I’m afraid will happen: as checkboxes are being generated inside that while, they won’t generate with the same id/name? If yes, when dialing to block, it would not block all lines?
– Cesar Augusto
Inside each new checkbox? And the script to "block/unlock" and show an Alert before... How would it look? Or better said.. How I would script to select certain checkbox?
– Cesar Augusto