mhm mi esento da responsabilità non l ho testato ne niente di niente cosi scritto al volo
codice:
<script language="Javascript">
function checkForm(objForm) {
var i = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
var emailad = objForm.email.value;
if (!i.test(emailad)) {
alert("Please insert a valid e/mail address.");
objForm.email.focus();
return false;
}
return true;
}
</script>
<?
if ($_POST["ctl"]!=1){
echo "<form method=post action='".$_SERVER['PHP_SELF']."' onSubmit=return(checkForm(this))>";
echo "Nome <input type=text name=nome maxlength=100 style=width:100%>
Mail <input type=text name=email maxlength=100 style=width:100%>
<input type=hidden name=ctl value=1><input type=submit value=invia></form>";
}
else
{
if (mail($_POST["email"],"Subject","messaggio"))
echo "An e-mail has been sent to ".$_POST["email"].", from ".$_POST["nome"]."";
}
?>