(php) Mailform and HTML tags through flash

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
fastforward
Forum Newbie
Posts: 7
Joined: Sun May 07, 2006 6:08 am

(php) Mailform and HTML tags through flash

Post by fastforward »

Hi

So I'm currently trying to create a mailform which supports HTML tags.

This is how it works:

In my flashfile (.swf) the user is filling out some textfields. Then this data is sent out from flash to a .php file, which sends the email.

However, when I receive the mail, all links in the text disappears. So I look in the raw mail (I'm using Gmail), and each time there is a quotationmark ", a backslash \, is inserted before.

Now, I'm pretty sure it's due to the PHP code, is there someway to embed some of the text?

My PHP code:

Code: Select all

<?php 

// name sent from Flash 
$navn = utf8_decode($_POST['navn']); 

// e-mail sent from Flash 
$email = utf8_decode($_POST['email']); 

// message sent from Flash 
$kommentar = nl2br(utf8_decode($_POST['kommentar'])); 

// e-mails receiver 
$modtager = "mortenkh@gmail.com"; 

// e-mails topic 
$emne = "E-mail sendt via Flash formmail"; 

// e-mails sender 
$afsender = $navn . "<" . $email . ">"; 

// send e-mail 
mail($modtager, $emne, $kommentar, "From: $afsender\r\nContent-type: text/html; charset=iso-8859-1"); 

?>
The raw mail data:

Code: Select all

Hi,<br />
<br />
How are you doing?  -check out this <a href=\"http://www.macro-design.org\">link</a>.
What I wrote in my mailform:

Code: Select all

Hi,

How are you doing? -check out this <a href="http://www.macro-design.org">link</a>.
Have a nice day :D
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

Have a look at the magic_quotes setting in your php configuration... I've got the feeling it's enabled (and it really shouldn't be).
rami
Forum Contributor
Posts: 217
Joined: Thu Sep 15, 2005 8:55 am

Post by rami »

welcome to forum
most of time u get ur answer here ,simple one faster...

any way i am also new to php so may be this is not the answer but this will or may help you to solve problem
just a reference not full answer
(just for quick link)
http://codewalkers.com/tutorials/10/1.html
fastforward
Forum Newbie
Posts: 7
Joined: Sun May 07, 2006 6:08 am

How to use magic_quotes

Post by fastforward »

Wow, that's what I call fast feedback.. :D

@timvw

I'm a bit of a stranger to PHP. So I looked magic_quotes up at php.net - how does it work, do I just paste the "set_magic_quotes_runtime (1)" in my php code like below?:

Code: Select all

<?php 

set_magic_quotes_runtime (1)

// name sent from Flash 
$navn = utf8_decode($_POST['navn']); 

// e-mail sent from Flash 
$email = utf8_decode($_POST['email']); 

// message sent from Flash 
$kommentar = nl2br(utf8_decode($_POST['kommentar'])); 

// e-mails receiver 
$modtager = "mortenkh@gmail.com"; 

// e-mails topic 
$emne = "E-mail sendt via Flash formmail"; 

// e-mails sender 
$afsender = $navn . "<" . $email . ">"; 

// send e-mail 
mail($modtager, $emne, $kommentar, "From: $afsender\r\nContent-type: text/html; charset=iso-8859-1"); 

?>
@rami

Didn't do the trick, but thanks anyways :wink:

Thanks for the fast answers
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

I should have been more specific.. It's magic_quotes_gpc and you can't disable it at runtime.. (You can disable it in the php.ini file or override the ini setting in a .htaccess file though)

http://be2.php.net/manual/en/ref.info.p ... quotes-gpc
fastforward
Forum Newbie
Posts: 7
Joined: Sun May 07, 2006 6:08 am

Thanks

Post by fastforward »

@timvw

Found a workaround - thanks for the help..

Just used:

Code: Select all

// if the message contains backslashes, they (the backslashes) are deleted
if (get_magic_quotes_gpc()) 
{ 
  // If magic quotes is enabled - turn the string back into an unsafe string 
  $message = stripslashes($message); 
}
Thanks again :wink:
mamaluke
Forum Newbie
Posts: 19
Joined: Tue May 16, 2006 1:03 am

??

Post by mamaluke »

Flash forward, I have been looking everywheres on how to submit a formmail from flash. I was wondering if you could help me out with the code that you have to put in flash to do this?
fastforward
Forum Newbie
Posts: 7
Joined: Sun May 07, 2006 6:08 am

Flash form

Post by fastforward »

Hi

If it's some specific problem with some code you've already written, you need to upload it. If it's just a way to make a flash mailform, check out this tutorial: http://kirupa.com/developer/actionscrip ... _email.htm

Have a pleasent day :wink:
mamaluke
Forum Newbie
Posts: 19
Joined: Tue May 16, 2006 1:03 am

thanks

Post by mamaluke »

Ok thanks I think I finally coded everything right but what I have done was upload the formmail.php script to all my free php domains


110mb.com , ripway.net only problem now is the example for this formmail sender is working form their site I got it off of, but when i upload it to my free website it dont send the mail....

Is it impoosible to do this unless you own your own domain?

Even though these web host support free PHP are you still not aloud to use formmail for some reason?
fastforward
Forum Newbie
Posts: 7
Joined: Sun May 07, 2006 6:08 am

Not sure

Post by fastforward »

If your domain supports PHP, it should work, but I've never worked with free webhosting so I'm not sure.

However, it could also be something with your .php file, did you remember to double-check that you've replaced the mail for which the mails should be sent to, to your own mail, and is it spelled correctly.

Hope it works out :o
Post Reply