PDA

View Full Version : Contact form to php help please!



stevisgood
January 20th, 2007, 07:40 PM
I see this exact question posted every couple of days... except none of the previous posts help my situation... can someone please please please explain why on earth this code just doesnt work... i've tried every tutorial, every forum and every hint i could find... still no luck.

The form is inside a flash site.

the actionscript on the "submit" button is as follows:

on (release) {
url_var = "server_option="+_root.server_option+"&recipient="+_root.recipient+"&text1="+text1+"&text2="+text2+"text3="+text3;
getURL("contact."+_root.server_option+"?"+url_var, "_blank", "GET");
text1 = "your name";
text2 = "e-mail";
text3 = "comments";
}

and the contact.php form is as follows:

<?
$subject="from".$_GET['your_name'];
$headers= "From:".$_GET['your_email']."\n";
$headers.='Content-type: text/html; charset=iso-8859-1';
mail($_GET['recipient'], $subject, "
<html>
<head>
<title>Contact letter</title>
</head>
<body>

<br>
".$_GET['message']."
</body>
</html>" , $headers);
echo ("Your message was successfully sent!");
?>
<script>
resizeTo(300, 300)
//window.close()
</script>



I really would not bother you fine people if i hadn't exausted all avenues. My hosting provider refuses to talk code and only wants to monkey talk me. The mail function is enabled, and they use php 4.4.4

The error i get when i upload the html, swf and php files into the same folder is this:

404 Not Found
The requested URL /ym_site/contact.undefined?server_option=undefined&recipient=undefined&text1=asdsdf%20sd%20df&text2=df%20gdfg34%20dfg%20text3=dfg%20dfg%203%20de frg%20df&text1=asdsdf+sd+df&text2=df+gdfg34+dfg+&text3=dfg+dfg+3+defrg+df&label%5F01=your+name&label%5F02=e%2Dmail&label%5F03=comments&onEnterFrame=%5Btype+Function%5D&url%5Fvar=server%5Foption%3Dundefined%26recipient% 3Dundefined%26text1%3Dasdsdf+sd+df%26text2%3Ddf+gd fg34+dfg+text3%3Ddfg+dfg+3+defrg+df does not exist.

I have been up now for 30 hours trying to figure this out and my wife is complaining that my eyes are getting bloodshot. I've played with every variation of these codes as i could think of. Changed all the variable names, changed functions from GET to POST, removed the HTML to simplify the php... nothing works... what am i missing?

Any help would be greatly greatly appreciated.

stevisgood
January 21st, 2007, 02:42 AM
I think what makes this so hard to work is the following code that's been added to the overall form page:

label_01 = "your name";
label_02 = "e-mail";
label_03 = "comments";

text1 = label_01;
text2 = label_02;
text3 = label_03;

would that be causing the problem with the php?
or at least contributing?

jjcorreia
January 21st, 2007, 04:26 AM
Dont use getURL(). Use the LoadVars object, it was made for this. You can find all the info you need in the Flash Help under LoadVars.

Additionally, your URL string looks like it has a lot of undefined variables in it, so you will want to check to make sure the data is getting through, but only after you've converted your code to use the LoadVars methods.