-
Submit Form for Website
I have a simple submit form for my real estate site. It is name, email, phone, and message with the reset and submit buttons. I can not for the life of me figure out how to get this to work and send me emails/info requests. Here is the code on my submit button:
on (rollOver)
{
gotoAndPlay("s1");
}
on (releaseOutside, rollOut)
{
gotoAndPlay("s2");
}
on (release)
{
var phone_descr = _parent.phone_descr;
var your_name_descr = _parent.your_name_descr;
var your_email_descr = _parent.your_email_descr;
var phone = _parent.phone;
var message = _parent.message;
var your_email = _parent.your_email;
var your_name = _parent.your_name;
i = 1;
while (this["field_" + i])
{
this["field_" + i] = "";
++i;
}
_parent.message = "";
_parent.your_name = "";
_parent.your_email = "";
_parent.phone = "";
}
My reset is fine, but it is obvious that I am missing something and doing something wrong.
I need someone to tell me what I am doing wrong and what I can do to fix this. Or, they can help me find a tutorial or article that will help. My script skills are pretty limited and so is my understanding of flash, so all the help someone can give me is appreciated. I would be glad to send the file and let someone fix it if my lack of knowledge is a hinderance.
-
You can check out what I did on my Flash site for email. Its at
www.chrisgates.net
There is a file called email.php that sits in the server dir where the swf file is. The php file is this:
------- start code
<?
$destination="YOUR EMAIL ADDRESS";
$name=$_POST['name'];
$email=$_POST['email'];
$mes=$_POST['comments'];
$subject="TEXT OF YOUR SUBJECT LINE" ;
$mes="Name : $name\n
Email: $email\n
Comments: $mes\n";
mail($destination,$subject,$mes); ?>
-------- end code
In the frame of my flash file where the contact form is to be, this line is added to a keyframe:
------- start code
_root.contact_form.loadMovie("contact_form.swf");
------ end code
The "contact_form.swf" flash file has three keyframes in it. Frame 1 has a movie clip with the form fields and has this code on it:
-------- start code
stop();
_root.contact_form.form.name="";
_root.contact_form.form.email="";
_root.contact_form.form.comments="";
-------- end code
The movie clip form fields' instances are named accordingly. Frames 2 and 3 each have a stop(); on the frames. Frame 1 is a thank you for filling out the form. Frame 3 is a send back to the form if all the fields are not filled out.
The submit button has this code on it:
--------- start code
on (release) {
if(_root.contact_form.form.nume=="" || _root.contact_form.form.email=="" || _root.contact_form.form.comments==""){
_root.contact_form.gotoAndStop(3);
}
else{
_root.contact_form.form.loadVariables("email.php", "POST");
}
}
----------- end code
I hope this helps. The form on my site works great. I hope I didn't leave any holes in this explanation.
CG
-
Was your form a separate swf file that you inserted into your site swf or was it one that was integrated in the site. Mine is integrated...no separate file for the form. Also, I have name, email, phone, and comments...would I just add to your displayed code (copy/paste) so it displays phone also.
-
Yes, the form was a separate sfw file and the main flash file call it. It makes it nice that you can edit the form as needed and not mess with your other, probably larger, flash file.
And yea, just copy and paste, and add what fields you need. Be sure to name them instance-wise, and deal with them in your php file as well.
-
if you like you can download my flash-php feedback form from my library..hope it helps
-
Thanks for the link. Lots of good stuff there. Nice video juke box among them.
Thx,
CG
-