$_SESSION variable value with single quotes
Posted on 2008-11-11
I have a series of PHP scripts that authenticate a user (or, if not authenticated, redirect), and set a series of $_SESSION variables based on values stored in our employee database. All logins are standard characters, and the scripts are working fine, until I go to set $_SESSION['lname'] to odbc_result from the database that contains O'Brien. I've tried using addslashes() and htmlspecialchars()... but it doesn't seem to actually get set. Since I'm not prep'ing a statement for insert to the database, it's more having this string variable for reference later on, what would be the correct way to retrieve and maintain the apostrophe?
BTW, doing nothing just crashes the script with a generic 500 error in the browser. At least addslashes() will get the script to run, but variables aren't brought forth.
(Code snippets can be provided on request... running on Windows/Apache) Thanks! :) Derry