ho mancato un punto (però anche voi...)
Codice PHP:
$updateuser="update materie set lun='$userlun', mar='$usermar' where id='$id'";   mysql_query($updateuser)  
or die(
"Impossibile eseguire l'operazione per il seguente motivo:" mysql_error());