form mail, errore script. Chi trova l'errore?
-
ciao
ho messo wuesto FORM MAIL nel mio sito, tutto ok, solo che quando invio l'email esce scritto: VI PREGHIAMO DI COMPILARE TUTTI I CAMPI OBBLIGATORI.Lo script è composto da due file: SEND e CONTACT
Che cosa manca? Che devo fare? CHe devo COMPILARE + ?SEND
<?php
$receiverMail = "miaemail (e questo l'ho fatto)";
$name = ltrim(rtrim(strip_tags(stripslashes($_POST['name']))));
$email = ltrim(rtrim(strip_tags(stripslashes($_POST['email']))));
$subject = ltrim(rtrim(strip_tags(stripslashes($_POST['subject']))));
$msg = ltrim(rtrim(strip_tags($_POST['msg'])));
$ip = getenv("REMOTE_ADDR");
$msgformat = "From: $name ($ip)\nEmail: $email\n\n$msg";
// VALIDATION
if(empty($name) || empty($email) || empty($subject) || empty($msg)) {
echo "<h3>The email was not sent</h3><p>Please fill all the required fields</p>";
}
elseif(!ereg("^[_a-z0-9-]+(.[_a-z0-9-]+)@[a-z0-9-]+(.[a-z0-9-]+)(.[a-z]{2,3})$", $email)) {
echo "<h3>The email was not sent</h3><p>The email address is invalid</p>";
}
else {
mail($receiverMail, $subject, $msgformat, "From: $name <$email>");
echo "<h3>The email has been sent!</h3><p>I will get back to you as soon as possible.</p>"; }
?>CONTACT (questo è quello che ho inserito nel sito, è OK)
<form method="post" action="send.php">
Name:<br /><input name="name" type="text" size="30" maxlength="40" /><br /><br />
Email:<br /><input name="email" type="text" size="30" maxlength="40" /><br /><br />
Subject:<br /><input name="subject" type="text" size="30" maxlength="40" /><br /><br />
Message:<br /><textarea name="msg" cols="50" rows="6"></textarea><br /><br />
<input type="reset" value="Reset" /> <input type="submit" value="Send" />
</form> -
-
-
-
scusami ma ancora non ho capito. che significano quei DIE col numero?
quindi io dovrei scrivere:
if(empty($name)
empty($email)
empty($subject)
empty($msg)) {o no? penso di no cmq..ti prego dammi una sola risposta però buona e completa e non a spezzettoni, per favore

MI SERVE URGENTISSIMAMENTE
-
no... lo hai visto il mio msg? metti la fretta da parte e ragiona...
if(empty($name)) die('1'); elseif( empty($email)) die('2'); elseif(empty($subject)) die('3'); elseif( empty($msg)) die('4'); -
-
è un numero poi metti la frase che vuoi... in modo da caprie quale campo non va bene...
non c'è bisogno di dire sempre vi prego rispondete...
Ciao! Sembra che tu sia interessato a questa conversazione, ma non hai ancora un account.
Stanco di dover scorrere gli stessi post a ogni visita? Quando registri un account, tornerai sempre esattamente dove eri rimasto e potrai scegliere di essere avvisato delle nuove risposte (tramite email o notifica push). Potrai anche salvare segnalibri e votare i post per mostrare il tuo apprezzamento agli altri membri della comunità.
Con il tuo contributo, questo post potrebbe essere ancora migliore 💗
Registrati Accedi
