ciao ragazzi sono nuovo del forum.
in questo file per far comparire la scritta occupato alla rig 149 devo cliccare due volte sul pulsante invio?
non riesco a capire il xchè!!!![]()
![]()
<?php
//Includo i file per la connessione
//e per la verifica Utente
require_once('connessione.php');
require_once('verificalogin.php');
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<script type="text/javascript">
function disabilita (valore1) {
if (valore1 == "") {
return true;
}
else {
alert("es già scelto");
return false;
}
}
function invia(form,statoesercizio){
if(disabilita(statoesercizio))
form.submit();
}
</script>
</head>
<body>
<h1>TUTOR VISUALIZZA ESERCIZI </h1>
</p>
<table width="76%" border="2" cellpadding="0" cellspacing="0" bordercolor="#999999">
<tr>
<td width="16%">titolo esercizio </td>
<td width="10%">argomento esercizio</td>
<td width="19%">nome libro da cui è preso esercizio</td>
<td width="13%">modalità invio soluzione</td>
<td width="14%">tipo di scuola </td>
<td width="14%"> anno</td>
<td width="14%">materia</td>
<td width="14%">tipo svolgimento richiesto </td>
<td width="14%">compenso</td>
<td width="14%">scadenza</td>
<td width="14%">scelta esercizio </td>
<td width="14%">scelta esercizi</td>
<td width="28%">stato esercizio </td>
</tr>
<?php
//testare la sessione
echo @$login_err;
if(IsSet($_SESSION['tutor'])){
echo "
Benvenuto tutor: ".@$_SESSION['tutor'][0];
}else{
echo "
Non sei autenticato !";
echo "
Effettua Login";
}
$usernamen=$_SESSION['tutor'][0];
//Effettuo il controllo dei dati
//$strSQL = "SELECT titoloesercizio FROM esercizio";
$query = "SELECT * FROM esercizio";
$ris=mysql_query($query) or die("Errore nella query:".mysql_error());
$numrows = mysql_num_rows($ris);
for($x=0; $x<$numrows; $x++){
//Recupero il contenuto di ogni record rovato
$resrow = mysql_fetch_row($ris);
$idesercizio=$resrow[0];
$idtutor=$resrow[1];
$titoloesercizio = $resrow[2];
$argomentoesercizio= $resrow[3];
$testo= $resrow[4];
$inviosoluzione= $resrow[5];
$stato= $resrow[6];
?>
<tr>
<td width="16%"> <? echo $titoloesercizio ; ?></td>
<td width="10%">
<? echo$argomentoesercizio ?></td>
<td width="19%">
<? echo $testo ?></td>
<td width="13%"><? echo $inviosoluzione ?> </td>
<td width="14%">
</td>
<td width="14%"></td>
<td width="14%"></td>
<td width="14%"></td>
<td width="14%"></td>
<td width="14%"></td>
<td width="14%">leggi esercizio</td>
<td width="14%">
<form $_POST['action']="<?php print $_SERVER["PHP_SELF"]; ?>" name="form<? echo $x ?>" method="POST">
<input name="statoesercizio" type="hidden" value="<?php echo $stato; ?>">
<input name="idesercizio" type="hidden" value="<?php echo $idesercizio; ?>">
<input type="button" name="n" value="Invia" onclick="invia(form<? echo $x ?>,form<? echo $x ?>.statoesercizio.value)">
<?php
$idesercizio = @$_POST['idesercizio'];
$usernamen=$_SESSION['tutor'][0];
$query4 = "SELECT * FROM tutor WHERE username ='$usernamen'";
$result4=mysql_query($query4) or die("Errore nella query:".mysql_error());
$row = mysql_fetch_assoc($result4);
$idtutor = $row['idtutor'];
$strSQL = "UPDATE esercizio SET statoesercizio='occupato', idtutor='$idtutor' WHERE idesercizio='$idesercizio'"; //echo $strSQL;
mysql_query($strSQL)OR die("Errore nella query1:".mysql_error());
?>
</form>
<td width="28%"><?php echo $stato; ?> </td> </td>
</tr>
<?php
}
?>
</table>
<?php
echo "
Vai all' homepage ";
?>