Page 1 of 1

<- Newb!!! Please help with Contact form to work with Flash

Posted: Mon Dec 08, 2008 11:47 am
by jhoshua
Hello everyone, Im having trouble with this Contact script for a website Im making for a church. Theres 3 files that need to be looked at and Im going to post the code for each one here. Please note that contacto@feyesperanzacali.com is the email where the contact information is supposed to be sent to,

First, the flash ActionScript code

Code: Select all

rec="contacto@feyesperanzacali.com";
serv="php";
 
var fields_descriptions= Array ("", 
                                    Array("t1", "your_name", "Tu Nombre:"), 
                                    Array("t2", "your_email", "Tu Email:"),
                                    Array("t3", "telephone", "Telefono:"),
                                    Array("t4", "message", "Escribe Tu Mensaje Aqui:"),
                                    Array("t5", "field_2", "E-mail:"),
                                    Array("t6", "field_3", "Address:"),
                                    Array("t7", "field_4", "fax:")
                                );
 
function reset_txt(name,name2,value) {
        path=eval(_target);
        path[name2]=value;
    
    this[name].onSetFocus=function() {
        path=eval(_target);
        if(path[name2]==value) { path[name2]="";} 
    }
    
    this[name].onKillFocus=function() {
        path=eval(_target);
        if(path[name2]=="") { path[name2]=value;} 
    }
}
 
 
for (i=1; i<=fields_descriptions.length; i++) {
    reset_txt("t"+i, fields_descriptions[i][1], fields_descriptions[i][2]);
}
 
 
Secondly the PHP contact file

Code: Select all

<?
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] ."\n";
 $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>&nbsp;&nbsp;&nbsp;".$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>
 
And finally, the contact active server document file.

Code: Select all

<%
    for i=1 to 7
        message=Request("message")
    next
        message=message + Request("message")    
        smtpServer = "mail.feyesperanzacali.com"
        smtpPort = 25
        
 
        name = Request("Your_Name:")
        Set myMail = CreateObject("CDO.Message") 
        myMail.Subject = "from " & name
        myMail.From = Request("Your_Email:")
        myMail.To = Request("recipient")
        myMail.HTMLBody = "<html><head><title>Contact letter</title></head><body><br>" & message & "</body></html>"
        myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
        myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = smtpServer
        myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = smtpPort
        myMail.Configuration.Fields.Update 
        myMail.Send
    
%>
 
I know Im a noob so please dont flame, Im just trying to find some help. Than ks in advance for those who do help.