This is Interesting: Free Magazines for Graphics designers and webmasters
Home > Archive > Dreamweaver > August 2004 > email form help (PHP)
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
email form help (PHP)
|
|
| eye-see 2004-08-26, 12:21 pm |
| I have created a contact from in flash and i am using a PHP file to handle the
data on my server.
I have no clue about PHP so I asked on a forum how to write a PHP file using
my variables.
Someone kindly wrote out most of the file and I filled in the rest the best I
could.
When testing the form, I recieve an email with the headers and subject appear
but no message appears, only the
word " 0f_comments " is in my email.
Can someone look at my code (attached below) and see what could be wrong with
it as I do not understand what is going on at all.
Regards
eye-see
<?php
$headers .= "From: $f_name <$f_email>\n";
$headers .= "Content-Type: text/plain; charset=iso-8859-1\n";
$recipient = $email_to;
$subject = "Form Submission";
$myMessage="Telephone: " . $gatherForm.f_telno + "\n; Company Name: " .
$gatherForm.f_compname + "\n; Company Address: " . $gatherForm.f_address + "\n;
Interest: " . $gatherForm.f_interest+ "\n; How did you hear about us?: " .
$gatherForm.f_hear + "\n; Comments: " . $gatherForm.f_comments;
$msg = wordwrap($myMessage, 1024 );
mail($recipient, $subject, stripslashes($msg), $headers);
?>
| |
| eye-see 2004-08-26, 12:21 pm |
| Can someone help with this problem, only im completely stuck at the moment
Thanks
eye-see
| |
| Michael Fesser 2004-08-26, 12:21 pm |
| .oO(eye-see)
>Can someone help with this problem, only im completely stuck at the moment
I'm wondering why you receive anything at all, the script is "somewhat"
broken.
The main issue is the use of + instead of . to concatenate strings. This
"works", but not as intended. Additionally the headers are wrong and the
script causes a whole bunch of notices. Who wrote that damn thing? ;)
First of all, can you post the code of your contact form or an URL? Or
at least some details: What method do you use (POST or GET) and what are
the names of the form fields?
Micha
| |
|
|
"eye-see" <webforumsuser@macromedia.com> wrote in message
news:cgidv5$725$1@forums.macromedia.com...
>I have created a contact from in flash and i am using a PHP file to handle
>the
> data on my server.
>
> I have no clue about PHP so I asked on a forum how to write a PHP file using
> my variables.
> Someone kindly wrote out most of the file and I filled in the rest the best
> I
> could.
>
> When testing the form, I recieve an email with the headers and subject
> appear
> but no message appears, only the
> word " 0f_comments " is in my email.
>
> Can someone look at my code (attached below) and see what could be wrong
> with
> it as I do not understand what is going on at all.
>
> Regards
>
> eye-see
>
> <?php
> $headers .= "From: $f_name <$f_email>\n";
> $headers .= "Content-Type: text/plain; charset=iso-8859-1\n";
> $recipient = $email_to;
> $subject = "Form Submission";
>
> $myMessage="Telephone: " . $gatherForm.f_telno + "\n; Company Name: " .
> $gatherForm.f_compname + "\n; Company Address: " . $gatherForm.f_address +
> "\n;
> Interest: " . $gatherForm.f_interest+ "\n; How did you hear about us?: " .
> $gatherForm.f_hear + "\n; Comments: " . $gatherForm.f_comments;
>
> $msg = wordwrap($myMessage, 1024 );
>
> mail($recipient, $subject, stripslashes($msg), $headers);
>
> ?>
>
It appears the concatenation of $myMessage string may be incorrect.
Try replacing the + with .
HTH
-Rb
| |
| eye-see 2004-08-26, 12:22 pm |
| I have made changes to my PHP file after looking at some more tutorials, but i
am still not receiving all of the data from the form. The 'headers' and
'subject' seem to work ok, but the message string only displays data from the
first field:
I recieve the following in my email:
Telephone: "number i typed in"
Why am I not getting the rest of the info???
Also, i tried replacing the '+' signs with '.' in my PHP but I got an error
saying "unexpected . "
the field names in my form are as follows:
'f_name', 'f_email', 'f_telno', 'f_compname', 'f_address', 'f_interest',
'f_hear', 'f_comments',
**** 'f_interest' is a combo box ****
the form i have created is in flash so it is probably not worth giving out my
url, but here is the FLASH actionscript (if it is any help?)that controls the
form:
stop();
var gatherForm:LoadVars = new LoadVars();
function sendForm() {
gatherForm.email_to = "myemail@email.com";
gatherForm.f_name = contactForm.userName.text;
gatherForm.f_telno = contactForm.userTelno.text;
gatherForm.f_email = contactForm.userEmail.text;
gatherForm.f_compname = contactForm.userCompname.text;
gatherForm.f_address = contactForm.userAddress.text;
gatherForm.f_interest = contactForm.userInterest.text;
gatherForm.f_hear = contactForm.userHear.text;
gatherForm.f_comments = contactForm.userComments.text;
gatherForm.send("formmail.php", "_blank", "POST");
}
this.contactForm.submitBtn.onRelease = function(){
if (contactForm.userEmail.text == "" || contactForm.userName.text == "" ||
contactForm.userTelno.text == "" || contactForm.userCompname.text == "" ||
contactForm.userAddress.text == "" || contactForm.userInterest.text == "Please
select...") {
gotoAndStop ("FormError");
} else {
sendForm();
gotoAndStop ("FormConfirm");
}
}
As far as I know, the flash code is correct as i followed a tutorial from a
macromedia book.
Can someone help with my PHP? (attached below)
Regards
eye-see
<?php
$headers .= "From: $f_name <$f_email>\n";
$headers .= "Content-Type: text/plain; charset=iso-8859-1\n";
$recipient = $email_to;
$subject = "Form Submission";
$message="Telephone: " . $_POST["f_telno"]; + "\n; Company Name: " .
$_POST["f_compname"]; + "\n; Company Address: " . $_POST["f_address"]; + "\n;
Interest: " . $_POST["f_interest"];+ "\n; How did you hear about us?: " .
$_POST["f_hear"]; + "\n; Comments: " . $_POST["f_comments"];;
$msg = wordwrap($message, 1024 );
mail($recipient, $subject, stripslashes($msg), $headers);
?>
|
|
|
| | Copyright 2003 - 2009 forum4designers.com Software forum Computer Hardware reviews |
|