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 wrote a small function called "sanitize_input", when I had a problem with double quotes ( " ) and single quote ( ' ) which did not let my input being updated in the database.
I call this function with passing the POST and GET global variables before updating the input to the database. I am not using cookies or sessions extensively. So I am just enough with POST and GET. I wanted to know whether I am doing it correct? or I had to do this in a better way.
Couple minor issues with your code, but the main point is that you should be using the right function instead of addslashes. For example, with MySQL you should use mysql_real_escape_string to sanitize data.
I am sure the function doesn't return anything but you have tried to assign the return value.
I think that overwrites the existing value and result in a loss of data.