-1

I am trying to stop a webform giving "–" instead of "-"

$time = $_POST['CBTime'] ;
$fixtime = htmlspecialchars_decode($time);

...

"Contact them on $day at $fixtime.\n".

Is the PHP I have

And the element of the form is

<select class="callback-time" id="CBTime" name="CBTime"><option value="">Time</option><option>Any time</option>
<option>9am – 11am</option>
<option>11am – 2pm</option>
<option>2pm – 5pm</option>
</select>

So an example of what will be outputted form is:

Contact them on Wednesday at 9am – 11am.
Jordan
  • 61
  • 1
  • 14
  • Those are not HTML entities, it's merely you handling encodings incorrectly. [Handling Unicode Front To Back In A Web App](http://kunststube.net/frontback/) – deceze Dec 11 '15 at 12:48

1 Answers1

2

Sounds like an encoding issue.

In PHP place this at the top

header('Content-Type: text/html; charset=utf-8');

if connecting to MySQL place this after the connect

mysql_set_charset('utf8');

betweeen your HTML head tags place this

<meta charset="UTF-8">

When saving files in the PHP editor, ensure they are in UTF8 format

Ben
  • 8,894
  • 7
  • 44
  • 80
David D
  • 1,269
  • 17
  • 22