Ciao a tutti,
sono un neofita del PHP e avrei bisogno del vostro aiuto. Ho scarico un piccolo form per l'invio di email in PHP dal mio sito. Ho seguito le istruzioni ma mi da sempre errore, non so perchè. Vi posto il codice:
e questo è il codice PHP che richiama<form method="post" action="sendeail.php">
<?php
$ipi = getenv("REMOTE_ADDR");
$httprefi = getenv ("HTTP_REFERER");
$httpagenti = getenv ("HTTP_USER_AGENT");
?>
<input type="hidden" name="ip" value="<?php echo $ipi ?>" />
<input type="hidden" name="httpref" value="<?php echo $httprefi ?>" />
<input type="hidden" name="httpagent" value="<?php echo $httpagenti ?>" />
Nome:
<input type="text" name="visitor" size="35" />
E-mail:
<input type="text" name="visitormail" size="35" />
Interessato in:
<select name="attn" class="menu" size="1">
<option class="red" value=" Sales n Billing ">Proposta lavoro </option>
<option value=" General Support ">Info generali </option>
<option value=" Technical Support ">Supporto tecnico </option>
<option value=" Webmaster ">Webmaster </option>
</select>
Messaggio:
<textarea name="notes" rows="4" cols="40"></textarea>
<input type="submit" class="bottone" value="Send Mail" />
</form>
No so perchè anche compilando tutti i form in modo corretto non mi invia alcuna email, mi da una pagina di errore molto confusa, non elabora niente e si vedono addirittura dei pezzi di codice PHP :master:Codice PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Sendemail Script</title>
</head>
<body>
<?php
$ip = $_POST['ip'];
$httpref = $_POST['httpref'];
$httpagent = $_POST['httpagent'];
$visitor = $_POST['visitor'];
$visitormail = $_POST['visitormail'];
$notes = $_POST['notes'];
$attn = $_POST['attn'];
if (eregi('http:', $notes)) {
die ("Do NOT try that! ! ");
}
if(!$visitormail == "" && (!strstr($visitormail,"@") || !strstr($visitormail,".")))
{
echo "<h2>Use Back - Enter valid e-mail</h2>\n";
$badinput = "<h2>Feedback was NOT submitted</h2>\n";
echo $badinput;
die ("Go back! ! ");
}
if(empty($visitor) || empty($visitormail) || empty($notes )) {
echo "<h2>Use Back - fill in all fields</h2>\n";
die ("Use back! ! ");
}
$todayis = date("l, F j, Y, g:i a") ;
$attn = $attn ;
$subject = $attn;
$notes = stripcslashes($notes);
$message = " $todayis [EST] \n
Attention: $attn \n
Message: $notes \n
From: $visitor ($visitormail)\n
Additional Info : IP = $ip \n
Browser Info: $httpagent \n
Referral : $httpref \n
";
$from = "From: $visitormail\r\n";
mail("antonio@autiero.net", $subject, $message, $from);
?>
<p align="center">
Date: <?php echo $todayis ?>
Thank You : <?php echo $visitor ?> ( <?php echo $visitormail ?> )
Attention: <?php echo $attn ?>
Message:
<?php $notesout = str_replace("\r", "
", $notes);
echo $notesout; ?>
<?php echo $ip ?>
[url="index.php"] Next Page [/url]
</p>
</body>
</html>
Non so dove sbattere la testa![]()