Personal I need a lot of help I have an input for the person to make a transfer in cash but if that person has 30 reais of money and she enters a value of 100 reais to make the transfer she will have balance -100 eu I want her to be able to transfer as much money as she can in the database.
Code that I use to transfer the user to the bank
<div class="tab-pane" id="thee-tab">
<p><form method="POST" action="?pagina=setting">
<center>
<select name="id">
<?php
$result_usuario = "SELECT * FROM 'usuarios' WHERE id=1";
$mostra_dados = mysqli_query($conn, $result_usuario);
while($rows_cursos = mysqli_fetch_assoc($mostra_dados)){ ?>
<option value="<?php echo $rows_cursos['id']; ?>"><?php echo $rows_cursos['usuario']; ?></option>
<?php } ?>
</select>
Dinheiro: <input type="text" name="dinheiro" max="<?php echo $rows_cursos['dinheiro']; ?>">
Code that I use to update the database by decreasing the typed value of the user and adding the account in the database
$id = $_POST['id'];
$dinheiro = $_POST['dinheiro'];
$_SESSION['id'] = $id;
$_SESSION['dinheiro'] = $dinheiro;
$recebe_dados1 = "UPDATE usuarios SET dinheiro = dinheiro -'$dinheiro' WHERE id = '".$_SESSION['usuarioId'] ."'";
$recebe_dados2 = "UPDATE usuarios SET dinheiro = dinheiro +'$dinheiro' WHERE id = $id";
$recebe_dados3 = "UPDATE usuarios SET depositado = depositado +'$dinheiro' WHERE id = '". $_SESSION['usuarioId'] ."'";