Salve a tutti,scusate ma sono proprio alle primissime armi con php e sto cercando di modificare un piccolo form per segnalare il sito,ho aggiunto un campo per scrivere note nel form e poi ho modificato il file php ma non include il campo "note" quando spedisce la mail,mi potete dire perfavore quale è errore?
Codice HTML:
<body><form method="post" action="segnala_amico.php" target="iframe_invia" name="segnala_amico">
Il tuo nome<br>
<input name="nome" type="text">
<br><br>
La E-mail del tuo amico<br>
<input name="email" type="text">
<br />
<br />
<b>Note</b><br>
<textarea name="note" cols="42" rows="5" class="modulo"></textarea>
<br><br>
<input value="Invia" type="submit">
</form>
<br><br>
<iframe name="iframe_invia" src="/busta.jpg" marginwidth="0" marginheight="0"
frameborder="0" width="300" height="300" scrolling="no" style="border:#CCCCCC 1px solid;">
</iframe>
</body>
Codice php:
Codice PHP:
<body><?php
function check_email ($email)
{
if(!eregi("^[a-z0-9][_\.a-z0-9-]+@([a-z0-9][0-9a-z-]+\.)+([a-z]{2,4})$",$email)){
return false;
} else {
return true;
}
}
function invia_segnalazione()
{
// IMPOSTIAMO LE VARIABILI DELLA MAIL
$nome=$_POST['nome'];
$email=$_POST['email'];
$sito="www.*****.it";
$note = $_POST["note"];
$verifica=check_email ($email);
if(empty($email) OR $verifica==FALSE OR empty($nome))
{
echo "<!DOCTYPE HTML>
<html>
<head>
<title>Invio non riuscito</title>
</head>
<body>
<div style=\"width:300px; text-align:center; padding:10px 0;
font-size:13px; font-family:Verdana,Arial,Tahoma,Helvetica,sans-serif;\">
<p style=\"font-size:18px; color:red;\">Attenzione!</p>";
if(empty($nome))
{echo "Non hai inserito il nome.<br/><br/>";}
if(empty($email) or $verifica==FALSE)
{echo "Non hai inserito l'indirizzo E-mail,<br/>
oppure hai inserito<br/>un indirizzo E-mail non valido.<br/><br/>";}
echo "<input type=\"button\" value=\"OK\" onclick=\"window.location.href='busta.jpg'\">
</div>
</body>
</html>";
}
else
{
$message ="Ciao, sono $nome.\n\nTi segnalo questo sito, è molto interessante:\n\n";
$message .="$sito\n\n";
$intestazioni .= "From: $nome<noreply@noreply.it>\r\n";
mail("$email","Ti segnalo questo sito.",$message,$intestazioni);
$message .="$note ('##NOTE##',)";
echo "<!DOCTYPE HTML>
<html>
<head>
<title>Dati inviati correttamente</title>
</head>
<body>
<div style=\"width:300px; text-align:center; padding:10px 0;
font-size:13px; font-family:Verdana,Arial,Tahoma,Helvetica,sans-serif;\">
<p style=\"font-size:18px; color:green;\">Dati inviati<br/>correttamente</p>
<br/>
<input type=\"button\" value=\"OK\" onclick=\"window.location.href='busta.jpg'\">
</div>
</body>
</html>";
}
}
invia_segnalazione();
?>
</body>
</html>