Ora funziona!!Grazie mille per le dritte!!
PHP:
<?
session_start();
$DEPOSITO=$_POST["DEPOSITO"];
require '../../config/includes_into.php';
$db=dbconnect();
function ValidateFloat($float) {
$val = htmlentities(strip_tags(trim($float)));
$val = str_replace(",", ".", str_replace(".", "", $val));
$val = (float)filter_var($val, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
return $val;
}
$DEPOSITO = ValidateFloat($DEPOSITO);
$sq="SELECT soldi FROM personaggi WHERE id = " . $_SESSION['id_pg'];
$Result = mysql_query($sq);
$rs = mysql_fetch_array($Result);
$soldi = $rs["soldi"];
If ($soldi < $DEPOSITO){
echo "<script language='javascript'>alert('Non Possiedi Questa Somma');</script>";
}
else {
$deposito= ("UPDATE personaggi SET Banca = Banca + $DEPOSITO WHERE id = " . $_SESSION['id_pg']);
mysql_query("$deposito") or die(mysql_error());
$agg_soldi= ("UPDATE personaggi SET soldi = soldi - $DEPOSITO WHERE id = " . $_SESSION['id_pg']);
mysql_query("$agg_soldi") or die(mysql_error());
print "<script language='javascript'>alert('Deposito effettuato con successo.');</script>";
}
mysql_close ();
?>
<html>
<head>
<title>Deposita</title>
<link rel="stylesheet" href="../stile.css" type="text/css">
</head>
<center>
<h1><font color="#800000">Banca</font></h1>
<br><br><br>
<form method="post" action="banca.php" name="DEPOSITA">
<input type="Submit" name="Indietro" value="Indietro" class="textFieldBase">
</form>
</center>
</html>