Salve a tutti!!
Dovrei nel mio javascript interrogare un database, esportarne delle variabili, contollarle e incaso eseguire un alert.
Questo è il mio codice:
---------------------------------
function sms(Form) {
bono=true;
if (bono==true & Form.smstesto.value.length < 1) {
alert("Attenzione: inserire testo messaggio!");
Form.smstesto.focus();
bono=false;
}
if (bono==false)
{<? $q="SELECT numero_sms_inviati FROM sms WHERE username='$username'";
$r=mysql_query($q) or die ('errore query 1');
$dr=mysql_fetch_assoc($r);
$inviati=$dr[numero_sms_inviati];
$qq="SELECT numero_sms_massimo FROM sms WHERE username='$username'";
$rr=mysql_query($qq) or die ('errore query 2');
$drr=mysql_fetch_assoc($rr);
$massimo=$drr[numero_sms_massimo];
$rimanente=$massimo-$inviati;?>
if (<?$rimanente<=0?>){ alert ("Attenzione: SMS Terminati!");}
bono=true;}
return bono;
------------------------------
Qualcuno mi può aiutare??