Ciao a tutti, qualcuno può aiutarmi?? sarebbe un form per un invio di mail che intercetta nella stessa pagina e rimanda un alert nel caso dell'invio. Funziona bene ed invia la mail ma non mi chiama l'alert. Sono un "principiante" in PHP quindi se ci sono errori grossolani scusate :P
L'"onsubmit" funziona bene quindi non è un problema.
La parte in PHP
Codice PHP:
<?php
if(isset($_POST['send'])) {
$submit = $_POST['send'];
// Message Body
$mess = "Ricevuta email da:\n\n";
$mess .= "Nome: " . trim(stripslashes($_POST["name"])) . "\n";
$mess .= "E-Mail: " . trim(stripslashes($_POST["mail"])) . "\n";
$mess .= "Telefono: " . trim(stripslashes($_POST["phone"])) . "\n\n\n";
$mess .= "Messaggio:\n" . trim(stripslashes($_POST["message"]));
// Sender
$sender="From:". trim(stripslashes($_POST["mail"]));
// Mail Sending
mail("miamail@mail.it", "Info", $mess, $sender);
echo "<body onLoad='alert('Your e-mail has been sent.')'>";
}
else {
echo "<body>";
}
?>
La parte del form
codice:
<form id="form1" name="mailsend" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>" onSubmit="return checkForm(this);">
<div class="formdiv">Name</div>
<input name="name" id="name" class="formstyle" title="name">
<div class="formdiv">E-Mail</div>
<input name="mail" id="mail" class="formstyle" title="mail">
<div class="formdiv">Telephone</div>
<input name="phone" id="phone" class="formstyle" title="phone">
<div class="formdiv">Message</div>
<textarea name="message" class="formstyle" cols="16" rows="10" title="message">
</textarea>
<input name="send" type="submit" value="" style="float:right;background:url(images/icon/push.png) center;width:58px;height:32px;"/>
<input name="reset" type="reset" value="" style="float:right;background:url(images/icon/undo.png) center;width:58px;height:32px;"/>
</form>