Skip to main content
Participant
January 8, 2010
Question

problems with line breaks in a "Input Text Field"

  • January 8, 2010
  • 1 reply
  • 462 views

Hi all,

I've create an email form in flash that uses ac3 and php to send out an email when the users click on the submit button. However, the email I receive loses all line break information.

example:
user inputs:

hi
there
form

I will get an email that is 1 line only "hithereform"

Here is the ac3 code:
var email_data:String = "name=" + contactName_txt.text
+ "&email=" + contactEmail_txt.text
+ "&subject=" + "Web Form Message"
+ "&message=" + contactMessage_txt.text;

And the php code:
<?php
$contact_name = $_POST['name'];
$contact_email = $_POST['email'];
$contact_subject = $_POST['subject'];
$contact_message = $_POST['message'];

if( $contact_name == true )
{
$sender = $contact_email;
$receiver = "a@1234.com";
$client_ip = $_SERVER['REMOTE_ADDR'];
$email_body = "Name: $contact_name \nEmail: $sender \n\nSubject: $contact_subject \n\nMessage: \n\n$contact_message \n\nIP: $client_ip ";
$extra = "From: $sender\r\n" . "Reply-To: $sender \r\n" . "X-Mailer: PHP/" . phpversion();

if( mail( $receiver, "$contact_subject", $email_body, $extra ) )
{
echo "success=yes";
}
else
{
echo "success=no";
}
}
?>


Can anyone tell me what I did wrong?
Thank you very much in advance

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
January 8, 2010

you should be using:

urlV.name = contactName_txt.text;

urlV.email = contactEmail_txt.text;

etc

where urlV is your urlVariables instance and you assign your urlrequest's data property to be urlV.

mmdmmd2Author
Participant
January 8, 2010

Thank for helping me (again) kglad.

I didn't paste the entire submit function, i am sorry if I confused anyone.I am very new to this, can you please tell me what I need to replace?


Here it is

function submit(e:MouseEvent):void
{
    if(contactName_txt.text == "" || contactPhone_txt.text == "" || contactEmail_txt.text == "" || contactMessage_txt.text == "")
       {
           message_status.text = "invalid text.";
       }
              else if( !validate_phone(contactPhone_txt.text))
       {
           message_status.text = "invalid phone.";
       }
       else if( !validate_email(contactEmail_txt.text))
       {
           message_status.text = "invalid email.";
       }

       else
       {
           message_status.text = "sending";
          
           var email_data:String = "name=" + contactName_txt.text
                       + "&email=" + contactEmail_txt.text
                    + "&subject=" + "Web Form Message"
                    + "&message=" + contactMessage_txt.text;
                   
                    var URL_vars:URLVariables = new URLVariables(email_data);
                    URL_vars.dataFormat = URLLoaderDataFormat.TEXT;
                   
                    URL_request.data = URL_vars;
                    var_load.load(URL_request);
                    var_load.addEventListener(Event.COMPLETE, receive_response);
       }
}

mmdmmd2Author
Participant
January 8, 2010

And here is an example of the email I receive:

Name: 45345 
Email: a@a.com

Subject: Web Form Message
Message:

testtesttest

But I typed
test
test
test

not testtesttest shown in the email.