PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I have the following code that displays names in with a checkbox. The user selects the names he wants and that then get passed to a variable so that I can post it back to the parrent page. This all works with the exception of names that have appostrophes in them. I have tried using addslashes and stripslashes but have not been able to get what I want.
here is code for the page. any help would be greatly appreciated.
letournp wrote:This all works with the exception of names that have appostrophes in them.
So names with apostrophes cannot be displayed or can be displayed but their values is not passed along?
If you have a value in your database that contains an apostrophe (or quotes) use stripslashes() to display them and when you pass the value back to the database use mysql_real_escape_string() to escape them.
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
I tried using stipslashes but it does not seem to work. the issue is when I pass the data back to the a variable it does not have anything past the apostrophe.
here is what I get when I select the name with the apostrophe and submit the form and do a view source in firefox.
<form name='fDynamic' method='post'><table width='100%'><tr><td><input type='checkbox' name='myCheckbox[]' value='Alain L'Archevêque' > Alain L'Archevêque</td>...
var SList = "Alain L, "; <-- this is where I am having and issue.
Maybe I am just putting the stripslashes in the wrong place. this is where i put it.