Hi I have a contact form which works perfectly fine, i Just need to modify AS a little so it will give error alert if email or name field are blank, but I cant get it to work pls help
Button code
on (release) {
for (i=1; i<_parent.fields_descriptions.length; i++) {
if (_parent[_parent.fields_descriptions*[1]]!=undefined) {
this[_parent.fields_descriptions*[1]]=_parent[_parent.fields_descriptions*[1]]+"&777&"+_parent.fields_descriptions*[2];
}
}
this.recipient=_parent.rec;
//i=undefined;
getURL(“contact.”+_parent.serv, “_blank”, “POST”);
}
frame code
stop ();
rec=“emailhere”;
serv=“php”;
var sunny= _root.style
var fields_descriptions= Array ("",
Array(“t1”, “your_name”, “Your Name:”),
Array(“t2”, “your_email”, “Your Email:”),
Array(“t3”, “telephone”, “Telephone:”),
Array(“t4”, “message”, “Message:”),
Array(“t5”, “colour”, “Colour:”),
Array(“t6”, “qty”, “Qty:”),
Array(“t7”, “sunny”, “Style:”)
);
for (i=1; i<=fields_descriptions.length; i++) {
this[“k”+i].text=fields_descriptions*[2];
}
PHP CODE
Quote:
<?
Error_Reporting(E_ALL & ~E_NOTICE);
while ($request = current($_REQUEST)) {
if (key($_REQUEST)!=‘recipient’) {
$pre_array=split ("&777&", $request);
$post_vars[key($_REQUEST)][0]=$pre_array[0];
$post_vars[key($_REQUEST)][1]=$pre_array[1];
}
next($_REQUEST);
}
reset($post_vars);
$subject="From ".$post_vars[‘your_name’][0] ;
$headers= "From: “.$post_vars[‘your_email’][0] .”
";
$headers.=‘Content-type: text/html; charset=iso-8859-1’;
$message=’’;
while ($mess = current($post_vars)) {
if ((key($post_vars)!=“i”) && (key($post_vars)!=“your_email”) && (key($post_vars)!=“your_name”)) {
$message.="<strong>".$mess[1]."</strong> “.$mess[0].”<br>";
}
next($post_vars);
}
mail($_REQUEST[‘recipient’], $subject, "
<html>
<head>
<title>Contact letter</title>
</head>
<body>
<br>
“.$message.”
</body>
</html>" , $headers);
echo (“Your message was successfully sent!”);
?>
<script>
resizeTo(300, 300);
</script>