I have an HTML form that a user can input text into a title
field, I then have php creating an HTML file called title.html
My problem is that users can input spaces and apostrophes into the title field that can't be used in the html file name. I replaced the spaces with underscores by using:
$FileName = str_replace(" ", "_", $UserInput);
However, I can't seem to remove single-quotes? I have tried using:
$FileName = preg_replace("/'/", '', $UserInput);
but this took test's
and turned it into test\s.html
.