Yes, but htmlspecialchars is supposed to handle slashes. I think the problem has something to do with the way I have done the concat. For whatever reason, the following version works. However, I was trying to do with single quotes instead of double quotes:
I understand, that is why I posted that code. By trying to use single quotes, it was interpreting the apostrophe in the last name. Allow me to interpret how PHP was interpreting your code:
' " Bénny O';
Do you see it now? PHP was interpreting the apostrophe as an end point of parsing the data.
busboy, I don’t see anything wrong in the code you posted. And I copy-pasted it, and it ran just fine for me. That should mean that the real issue is elsewhere in the code you haven’t posted.
Note the coloring, and you’ll see why you got what you did.
If you want apostrophes to be converted, you’ll have to specify that flag when you call htmlspecialchars;
htmlspecialchars($lastName,ENT_QUOTES|ENT_HTML401)
This will convert both " and ’ to their HTML Entities.
(EDIT: Yeah, and SP wont let me put in the special characters lol. I’ve removed the &'s in front of them to make it not-translate, but you get the picture.
If you put & on the front of entity codes as you enter them the & should display without converting the codes - or simply specify the code outside of a code box and it will not get converted at all.