Go Back   CodingForums.com > :: Client side development > Flash & ActionScript

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-28-2009, 11:25 PM   PM User | #1
98stang
New to the CF scene

 
Join Date: Feb 2009
Posts: 8
Thanks: 1
Thanked 0 Times in 0 Posts
98stang is an unknown quantity at this point
Help with a Flash Contact Form

I'm new to this flash and .php thing and I don't know whether this goes into the flash section or the php section. Anways I'm trying to get a flash contact form to work. Here is the AS for the movie clip

Code:
onClipEvent(mouseDown){

var senderLoad:LoadVars = new LoadVars();


sender.onRelease = function() {
   senderLoad.tf_1 = tf_1.text; 
   senderLoad.tf_2 = tf_2.text; 
   senderLoad.tf_3 = tf_3.text;
   senderLoad.tf_4 = tf_4.text;
   senderLoad.send("contact.php", "_blank", "POST");
 }
}

Here is the .php file.

Code:
<?PHP







$to = "myemail";
$subject = "Hello, I have a question or comment";
$message = "Name: " . $_POST['tf_1'];
$message .= "\nEmail: "  . $_POST['tf_3'];
$message .= "\nState: "  . $_POST['tf_4'];
$message .= "\n\nMessage: "  . $_POST['tf_2'];


ini_set('SMTP', 'relay-hosting.secureserver.net');    //read u need this here for GoDaddy

mail($to,$subject,$message,$headers);

?>
The host for the website is GoDaddy and they have their own gdform.php file but I have no idea how to incorporate the AS into the .php file. Here is the gdform.php they give you
Code:
<?php
$request_method = $_SERVER["REQUEST_METHOD"];
if($request_method == "GET"){
$query_vars = $_GET;
} elseif ($request_method == "POST"){
$query_vars = $_POST;
}
reset($query_vars);
$t = date("U");

$file = $_SERVER['DOCUMENT_ROOT'] . "/../data/gdform_" . $t;
$fp = fopen($file,"w");
while (list ($key, $val) = each ($query_vars)) {
fputs($fp,"<GDFORM_VARIABLE NAME=$key START>\n");
fputs($fp,"$val\n");
fputs($fp,"<GDFORM_VARIABLE NAME=$key END>\n");
if ($key == "redirect") { $landing_page = $val;}
}
fclose($fp);
if ($landing_page != ""){
header("Location: http://".$_SERVER["HTTP_HOST"]."/$landing_page");
} else {
header("Location: http://".$_SERVER["HTTP_HOST"]."/");
}


?>
Any help is appreaciated.
98stang is offline   Reply With Quote
Old 03-03-2009, 02:04 PM   PM User | #2
gnomeontherun
Senior Coder

 
gnomeontherun's Avatar
 
Join Date: Sep 2007
Location: Houston
Posts: 2,846
Thanks: 10
Thanked 238 Times in 229 Posts
gnomeontherun will become famous soon enoughgnomeontherun will become famous soon enough
What do you need help with, and whats the problem?
__________________
jeremy - gnomeontherun
Educated questions often get educated answers, and simple questions often get simple answers.
gnomeontherun is offline   Reply With Quote
Users who have thanked gnomeontherun for this post:
98stang (03-17-2009)
Old 03-03-2009, 02:57 PM   PM User | #3
98stang
New to the CF scene

 
Join Date: Feb 2009
Posts: 8
Thanks: 1
Thanked 0 Times in 0 Posts
98stang is an unknown quantity at this point
The problem is I cannot get the email to work. Nothing gets sent to my email box.
98stang is offline   Reply With Quote
Old 03-03-2009, 07:42 PM   PM User | #4
gnomeontherun
Senior Coder

 
gnomeontherun's Avatar
 
Join Date: Sep 2007
Location: Houston
Posts: 2,846
Thanks: 10
Thanked 238 Times in 229 Posts
gnomeontherun will become famous soon enoughgnomeontherun will become famous soon enough
http://www.kirupa.com/developer/acti..._php_email.htm

Check that first and try those techniques.

Then verify that your information is getting sent to PHP.

So instead of having it mail have it echo out the variables.

Code:
<?php
echo $_POST['tf_1'];
echo $_POST['tf_3'];
echo $_POST['tf_4'];
echo $_POST['tf_2'];

?>
And report back if the variables are getting sent to PHP. That way I know if its PHP or AS.
__________________
jeremy - gnomeontherun
Educated questions often get educated answers, and simple questions often get simple answers.
gnomeontherun is offline   Reply With Quote
Old 03-03-2009, 09:39 PM   PM User | #5
98stang
New to the CF scene

 
Join Date: Feb 2009
Posts: 8
Thanks: 1
Thanked 0 Times in 0 Posts
98stang is an unknown quantity at this point
Well I looked on another forum and a person told me to do this

Code:
on (release) {
  
      loadVariablesNum("contact.php", 0, "POST");
       theName = _root.Name.txtName.text
       theState = _root.State.txtState.text
       theEmail = _root.Email.txtEmail.text
       theMessage = _root.Message.txtMessage.text
}
it's "_root.movieclipname.textinputname.text." Reason he said this was that my input text boxes each sit on a movie clip, meaning there's 4 movie clips.

Also on that website, Can I just rename the instance fields instead of selecting them all to make one movie clip?

Last edited by 98stang; 03-03-2009 at 09:44 PM..
98stang is offline   Reply With Quote
Old 03-04-2009, 09:05 AM   PM User | #6
gnomeontherun
Senior Coder

 
gnomeontherun's Avatar
 
Join Date: Sep 2007
Location: Houston
Posts: 2,846
Thanks: 10
Thanked 238 Times in 229 Posts
gnomeontherun will become famous soon enoughgnomeontherun will become famous soon enough
Lets focus on getting the PHP to work first, as it appears not to be working. Have you checked with your host on the proper setup? Do you really need that set_int thing? Or is something else missing?
__________________
jeremy - gnomeontherun
Educated questions often get educated answers, and simple questions often get simple answers.
gnomeontherun is offline   Reply With Quote
Old 03-04-2009, 04:12 PM   PM User | #7
98stang
New to the CF scene

 
Join Date: Feb 2009
Posts: 8
Thanks: 1
Thanked 0 Times in 0 Posts
98stang is an unknown quantity at this point
well the host is GoDaddy. I read on another forum where a user had GoDaddy and GoDaddy sent them an email saying to put that ini_set into the .php file. I pretty sure the .php file works (mine, not the GoDaddy one) because when I open the .php file, I get an email with the subject and such. It just doesn't show what user typed.
98stang is offline   Reply With Quote
Old 03-04-2009, 11:18 PM   PM User | #8
gnomeontherun
Senior Coder

 
gnomeontherun's Avatar
 
Join Date: Sep 2007
Location: Houston
Posts: 2,846
Thanks: 10
Thanked 238 Times in 229 Posts
gnomeontherun will become famous soon enoughgnomeontherun will become famous soon enough
Well test the PHP with test variables to verify that it is sending emails first. I want to know that is working before we proceed.
__________________
jeremy - gnomeontherun
Educated questions often get educated answers, and simple questions often get simple answers.
gnomeontherun is offline   Reply With Quote
Old 03-05-2009, 12:42 AM   PM User | #9
98stang
New to the CF scene

 
Join Date: Feb 2009
Posts: 8
Thanks: 1
Thanked 0 Times in 0 Posts
98stang is an unknown quantity at this point
the .php is working (tested it) this is the file (it's coded a little different)

PHP Code:
<?PHP

include_once("contact.php");


if (isset(
$HTTP_POST_VARS)) { 

$theName $HTTP_POST_VARS['theName']; 
$theState $HTTP_POST_VARS['theState']; 
$theEmail $HTTP_POST_VARS['theEmail']; 
$theMessage $HTTP_POST_VARS['theMessage']; 

 
$to "myemail";
 
$subject "Hello, I have a question or comment";
 
$message .= "Name: " ."$theName\n\n";
 
$message .= "State: " ."$theState\n\n";
 
$message .= "Email: " ."$theEmail\n\n";
 
$message .= "Message: " ."$theMessage\n\n"



ini_set('SMTP''relay-hosting.secureserver.net');

mail($to,$subject,$message);

?>
98stang is offline   Reply With Quote
Old 03-05-2009, 08:53 AM   PM User | #10
gnomeontherun
Senior Coder

 
gnomeontherun's Avatar
 
Join Date: Sep 2007
Location: Houston
Posts: 2,846
Thanks: 10
Thanked 238 Times in 229 Posts
gnomeontherun will become famous soon enoughgnomeontherun will become famous soon enough
Ok good, then we can work on the AS.

First, check that you have variable names (Not Instances!) and these should match your PHP like theName and theEmail. Then you can use the code from the other person, or just this should also work since you will have the variables set and won't need to grab the text field values.

Code:
on (release) {
  loadVariablesNum ("contact.php", 0, "POST");
 }
}
__________________
jeremy - gnomeontherun
Educated questions often get educated answers, and simple questions often get simple answers.
gnomeontherun is offline   Reply With Quote
Old 03-05-2009, 02:23 PM   PM User | #11
98stang
New to the CF scene

 
Join Date: Feb 2009
Posts: 8
Thanks: 1
Thanked 0 Times in 0 Posts
98stang is an unknown quantity at this point
it still sending the email without what the user typed. I check the variable names and they are correct. Also checked the names on the .php file and they are correct.
98stang is offline   Reply With Quote
Old 03-06-2009, 09:38 AM   PM User | #12
gnomeontherun
Senior Coder

 
gnomeontherun's Avatar
 
Join Date: Sep 2007
Location: Houston
Posts: 2,846
Thanks: 10
Thanked 238 Times in 229 Posts
gnomeontherun will become famous soon enoughgnomeontherun will become famous soon enough
Are you using this script or what I said?

Code:
on (release) {
  
      loadVariablesNum("contact.php", 0, "POST");
       theName = _root.Name.txtName.text
       theState = _root.State.txtState.text
       theEmail = _root.Email.txtEmail.text
       theMessage = _root.Message.txtMessage.text
}
What kind of form element is theMessage? Are you sure it is within a movieClip called Message with the instance name of txtMessage?

By the way, you should always put ; at the end of each set of commands.
__________________
jeremy - gnomeontherun
Educated questions often get educated answers, and simple questions often get simple answers.
gnomeontherun is offline   Reply With Quote
Old 03-10-2009, 03:16 PM   PM User | #13
98stang
New to the CF scene

 
Join Date: Feb 2009
Posts: 8
Thanks: 1
Thanked 0 Times in 0 Posts
98stang is an unknown quantity at this point
basically the input boxes are sitting on top of the movie clips. Also does it matter the the movie clips(the ones under the input boxes) are sitting on a movie clip?


Here is the website. Click on Contact to see the form I'm talking about.
http://www.wantedeyewear.com
98stang is offline   Reply With Quote
Old 03-10-2009, 09:57 PM   PM User | #14
gnomeontherun
Senior Coder

 
gnomeontherun's Avatar
 
Join Date: Sep 2007
Location: Houston
Posts: 2,846
Thanks: 10
Thanked 238 Times in 229 Posts
gnomeontherun will become famous soon enoughgnomeontherun will become famous soon enough
Yes but what is the code you finally settled on using?
__________________
jeremy - gnomeontherun
Educated questions often get educated answers, and simple questions often get simple answers.
gnomeontherun is offline   Reply With Quote
Old 03-17-2009, 02:40 PM   PM User | #15
98stang
New to the CF scene

 
Join Date: Feb 2009
Posts: 8
Thanks: 1
Thanked 0 Times in 0 Posts
98stang is an unknown quantity at this point
Contact Form Solved

problem solved

Last edited by 98stang; 03-17-2009 at 07:48 PM..
98stang is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:01 AM.


Advertisement
Log in to turn off these ads.