0

I have an html form that when users fill out, the information is processed and encoded into an email. The issue that keeps arising is when my company receives user emails the encoding turns colons, semi-colons, ampersands and commas into :, &#59;, & and , which makes emails difficult to read.

As a newcomer to PHP and encoding i'm not sure which approach to take. Should I convert the email to an html format or should I remove the encoding all together? Could someone provide information/guidance on approaching this conflict?

Thank is advance!

Courtney Jordan
  • 1,500
  • 1
  • 16
  • 18

3 Answers3

1

Should I convert the email to an html format

It will be better way, use html_entity_decode() to convert : into readable chars

Yaroslav
  • 651
  • 2
  • 9
  • 17
0

If I'm understanding you right the people filling out the form are putting in punctuation or chars that are being converted to asci. To stop this use:

$yourvariable = htmlspecialchars($_POST['your input field'], ENT_QUOTES);

This should strip out most of the nasty stuff.

tattooedgeek
  • 518
  • 1
  • 8
  • 22
0

You can use HTMLEntities, which converts applicable characters to HTML entities.

Also, strip_tags works, when you want to remove html tags from a message.

Sasanka Panguluri
  • 3,058
  • 4
  • 32
  • 54