I found a contact form a year or two ago online and its been working great. I learned flash by grabbing of the net and seeing how stuff is done so this might explain my memory loss :upset:
I found almost the exact same code that I use in a post on this site and thought someone may be able to help me.
Stage.scaleMode = "noScale";
Stage.showMenu = false;
stop();
init();
function init()
{
this.info_mc.stop();
this.info_mc._x = 1100;
this.send_btn._focusrect = false;
this.clear_btn._focusrect = false;
this.name_txt.tabIndex = 1;
this.email_txt.tabIndex = 2;
this.message_txt.tabIndex = 3;
this.from0_rb.tabIndex = 4;
this.from1_rb.tabIndex = 5;
this.send_btn.tabIndex = 6;
this.clear_btn.tabIndex = 7;
this.name_txt.text = "";
this.email_txt.text = "";
this.message_txt.text = "";
var from_arr:Array = new Array("Yes",
"No");
for (var i = 0 ; i < from_arr.length ; i++)
{
this["from" + i + "_rb"].groupName = "from_rg";
this["from" + i + "_rb"].label = from_arr*;
this["from" + i + "_rb"].selected = false;
}
this.from0_rb.selected = true;
setTextFocus(this.name_txt);
}
function setTextFocus(tf)
{
Selection.setFocus(tf);
}
this.send_btn.onPress = function ()
{
validateForm();
}
this.clear_btn.onPress = function ()
{
init();
}
function validateForm()
{
if ((name_txt.text.isset()) && (name_txt.text != "Required Field"))
{
if ((email_txt.text.isset()) && (email_txt.text.isEmail()) && (email_txt.text != "Required Field"))
{
trace("email_txt.text.isEmail() = " + email_txt.text.isEmail());
if ((message_txt.text.isset()) && (message_txt.text != "Required Field"))
{
trace("From : " + from_rg.getValue());
if (from_rg.getValue() != undefined)
{
info_mc.play();
info_mc._x = 487.8;
sendEmail();
}
}
else
{
message_txt.text = "Required Field";
setTextFocus(message_txt);
}
}
else
{
email_txt.text = "Required Field";
setTextFocus(email_txt);
}
}
else
{
name_txt.text = "Required Field";
setTextFocus(name_txt);
}
}
function sendEmail()
{
email_lv = new LoadVars();
email_lv.AName = this.name_txt.text;
email_lv.Email = this.email_txt.text;
email_lv.Join_Mailer = from_rg.getValue();
email_lv.Message = this.message_txt.text;
info_mc.gotoAndStop("Info" + this.result);
email_lv.sendAndLoad("gdform.php", email_lv, "POST");
}
Everything works great but I need to change the email it sends the results to and I can’t remember where that is all set. I thought it was in gdform.php but there is nothing in there. It has the following code in it…
[SIZE=2]<?php[/SIZE]
[SIZE=2]$request_method = $_SERVER["REQUEST_METHOD"];[/SIZE]
[SIZE=2]if($request_method == "GET"){[/SIZE]
[SIZE=2]$query_vars = $_GET;[/SIZE]
[SIZE=2]} elseif ($request_method == "POST"){[/SIZE]
[SIZE=2]$query_vars = $_POST;[/SIZE]
[SIZE=2]}[/SIZE]
[SIZE=2]reset($query_vars);[/SIZE]
[SIZE=2]$t = date("U");[/SIZE]
[SIZE=2]$file = $_SERVER['DOCUMENT_ROOT'] . "/../data/gdform_" . $t;[/SIZE]
[SIZE=2]$fp = fopen($file,"w");[/SIZE]
[SIZE=2]while (list ($key, $val) = each ($query_vars)) {[/SIZE]
[SIZE=2]fputs($fp,"<GDFORM_VARIABLE NAME=$key START>
");[/SIZE]
[SIZE=2]fputs($fp,"$val
");[/SIZE]
[SIZE=2]fputs($fp,"<GDFORM_VARIABLE NAME=$key END>
");[/SIZE]
[SIZE=2]if ($key == "redirect") { $landing_page = $val;}[/SIZE]
[SIZE=2]}[/SIZE]
[SIZE=2]fclose($fp);[/SIZE]
[SIZE=2]if ($landing_page != ""){[/SIZE]
[SIZE=2]header("Location: http://".$_SERVER["HTTP_HOST"]."/$landing_page");[/SIZE]
[SIZE=2]} else {[/SIZE]
[SIZE=2]header("Location: http://".$_SERVER["HTTP_HOST"]."/");[/SIZE]
[SIZE=2]}[/SIZE]
[SIZE=2]?>[/SIZE]
So it has to be somewhere in my form.fla doesn’t it. The form is still working correctly, so I am pulling my hair out. Thanks for any help you can give to my sanity.
Don