I have a table where there is a column called " estado
", each user / row / id has a status as a series, see ( 0,1,2
). The description of the states is: 0-inactive 1-active 2-banned. When loading the page I get the current status thanks to a conexión vía mysql a la bbdd.
What I want is: when clicking on an image / link of user X of the status column, I asked if you want to change it to the other two remaining states, choose which one, and activate it.
For example: as a series the user / ID 38 has status = 1 (active), I want to click on his image (a href) and he asks me with two buttons if I want to change to the state (button0) or to the state (button2) ). And I updated the result.
Code: I think the ruling is here:
echo "<td onclick='cambiar_estado(this);' width=\"10%\" id=\"".$row['ID_OBLIGATORIO']."\">" ?>
<!-- Columna ESTADO del usuario. -->
<center>
<?php
echo "<a href='#' data-toggle='modal' data-target='#modal_cambiar_estado' data-id='\"".$row['ID_OBLIGATORIO']."\">' class='cambiar_estado' onclick='cambiar_estado(this);'>";
echo "<img src=\"/imagenes/".$row['estado'].".gif\">";
echo "</a>"; ?>
</center>
<?php
echo "</td>";
?>
<div class="modal fade" tabindex="-1" role="dialog" id="modal">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span></button>
<h4 class="modal-title">Cambio de estados - Ventana emergente.</h4>
</div>
<div class="modal-body">
<p>¿Deseas cambiar el estado del usuario/ID?</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" id="boton_uno" class="boton-estado btn-primary">Boton 1</button>
<button type="button" id="boton_dos" class="boton-estado btn-primary">Boton 2</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->