Removing single-quote from a string in php

E-Michael

New Member
I have an HTML form that a user can input text into a \[code\]title\[/code\] field, I then have php creating an HTML file called \[code\]title.html\[/code\]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:\[code\]$FileName = str_replace(" ", "_", $UserInput);\[/code\]However, I can't seem to remove single-quotes? I have tried using:\[code\]$FileName = preg_replace("/'/", '', $UserInput); \[/code\]but this took \[code\]test's\[/code\] and turned it into \[code\]test\s.html\[/code\].
 
Back
Top