Problem with HTML tags in Flash 2 PHP form

Hi all,

I have a flash form that collects several variables and then sends them to PHP to be sent by e-mail.

All the variables are directly obtained by input text boxes except for one. This one gathers the info from both input boxes and dynamic text boxes that work more or less like a shopping cart, collecting data about the products. The visitor keeps adding them until he’s ready to send the order.

Generally, the form works fine and sends out the data but, the variable with the collected data from the products is loaded with html tags such as text alignment and size, among others.

I have tried stripping the tags both within flash and in the PHP code but I just can’t reach it. I also tried the Flash text boxes both rendering text as html and not. I tried implementing a strip_tags function in the PHP script, as it seemed the best approach, but I’m missing something.

the testing area is www.tropicalarte-brasil.pt/teste/ptindex.html. The login is “tateste” and after you have chosen any product from the main menu, press “adicione este produto à sua lista”, just input some number in each box and press “confirmar”. You can check the list of products under “verificar lista” and confirm it with the second or third arrow. Fill in the rest of the form and press “enviar”. You’ll receive a copy of the form and it won’t look pretty.

Here’s the PHP with the strip_tags function:

 
<?php
//$sendTo = "contacto@tropicalarte-brasil.pt";
$sendTo = "ricardo.ferreira@pointoview.net";
$content.= "Content-Type: text/html; charset=\"iso-8859-1\"
";
//$headers = "To: ricardo.ferreira@pointoview.net" . "
";
$headers = "From: " . $_POST["email"] . "
";
$headers = "Cc: " . $_POST["email"] . "
";
$headers .= "Reply-To: " . $_POST["email"] . "
";
$headers .= "Return-path: " . $_POST["email"];
$subject = $_POST["nome"] . " (" . $_POST["email"] . ")";
$message = "nome: " . $_POST["nome"] . "
" . "endereço: " . $_POST["endereco"] . "

" . "telefone/fax: " . $_POST["telefone"] . "
" . "
" . "e-mail: " . $_POST["email"] . "
" . "NIF: " . $_POST["nif"] . "
" . "Estes são os produtos que encomendou: " . "
" . $_POST["encomendaFinalVar"] . "

" . "Comentários ou correcções à encomenda: " . "
" . $_POST["mensagem"];
function strip_html_tags( $message )
{
    $message = preg_replace(
        array(
          // Remove invisible content
            '@<head[^>]*?>.*?</head>@siu',
            '@<style[^>]*?>.*?</style>@siu',
            '@<script[^>]*?.*?</script>@siu',
            '@<object[^>]*?.*?</object>@siu',
            '@<embed[^>]*?.*?</embed>@siu',
            '@<applet[^>]*?.*?</applet>@siu',
            '@<noframes[^>]*?.*?</noframes>@siu',
            '@<noscript[^>]*?.*?</noscript>@siu',
            '@<noembed[^>]*?.*?</noembed>@siu',
          // Add line breaks before and after blocks
            '@</?((address)|(blockquote)|(center)|(del))@iu',
            '@</?((div)|(h[1-9])|(ins)|(isindex)|(p)|(pre))@iu',
            '@</?((dir)|(dl)|(dt)|(dd)|(li)|(menu)|(ol)|(ul))@iu',
            '@</?((table)|(th)|(td)|(caption))@iu',
            '@</?((form)|(button)|(fieldset)|(legend)|(input))@iu',
            '@</?((label)|(select)|(optgroup)|(option)|(textarea))@iu',
            '@</?((frameset)|(frame)|(iframe))@iu',
        ),
        array(
            ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
            "
\$0", "
\$0", "
\$0", "
\$0", "
\$0", "
\$0",
            "
\$0", "
\$0",
        ),
        $message );
    return strip_tags( $message );
}
mail($sendTo, $subject, $message, $headers);
?>

Anyone has any ideas? I can also post the FLAs (they’re a few and only work if correctly put together), if necessary.

thanks in advance

RF

i found this forum post on google because i too have the same problem, i was wondering have you figured out what is wrong or does anyone else know how to fix this problem with flash

Thanx:thumb2:

[quote=BORKOYz;2356720]i found this forum post on google because i too have the same problem, i was wondering have you figured out what is wrong or does anyone else know how to fix this problem with flash

Thanx:thumb2:[/quote]

Hi, I solve the problem using PHP’s strip_tag() function and it worked fine. Here’s the line of code where I used it:


$message = "nome: " . $_POST["nome"] . "

" . "endereço: " . $_POST["endereco"] . "

" . "telefone/fax: " . $_POST["telefone"] . "

" . "e-mail: " . $_POST["email"] . "

" . "NIF: " . $_POST["nif"] . "

" . "******************" . "

" . "Estes são os produtos que encomendou: " . "
" . strip_tags($_POST["encomendaFinalVar"]) . "

" . "Comentários ou correcções à encomenda: " . "
" . $_POST["mensagem"];

Check this link: http://pt2.php.net/strip_tags, which can provide you better explanations about this function.

I hope this helped.

good luck

RF