[php] problema inserimento dati in database [era: non mi funge il php]
Salve ragazzi perchè questo script non mi funziona?
Codice PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<?php
if(isset($_POST['submit'])){
error_reporting(E_ALL);
include("../confi.ini.php");
//setto le variabili
$dest = $_POST['destinatario'];
$oggetto = $_POST['oggetto'];
$messaggio = $_POST['messaggio'];
$mittente = $_SESSION['nick'];
$date = date("d/m/Y H:i");
//controllo se esiste il destinatario...
$esiste=mysql_query("SELECT * FROM mp WHERE nick=".$dest."");
$NumRow = mysql_num_rows($esiste);
if($NumRow>0){
//se il nickname esiste, invia il messsaggio
$query="INSERT INTO mp(mittente,oggetto,messaggio,data) VALUES ('".$mittente."','".$oggetto."','".$messaggio."','".$date."') WHERE user='".$dest."'";
if(!mysql_query($query)){
echo"Errore conattare l' amministratore: Impossibile inviare il messaggio";
}else{
echo"Messaggio inviato con sucesso!";
}
}else{
//se non esiste...
echo "Errore, il destinatario non esite...";
}
}
?>
<form action="<? echo $_SERVER['PHP_SELF']; ?>" method="post">
<legend>Sciri un messaggio!</legend>
<legend>Destinatario</legend>
<dd><input type="text" name="destinatario" /> </dd>
<br />
<legend>Oggetto</legend>
<dd><input type="text" name="oggetto" /> </dd>
<br />
<legend> Messaggio </legend>
<dd> <textarea name="messaggio" rows="10" cols="30"></textarea></dd>
<br />
<input type="submit" name="sumbit" value="Invia mesaggio" />
</form>
<body>
</body>
</html>
non fà niente quando premo sul bottone provate voi Link (come mittente mette lolla)