I've got some files that call variables from php but I'm not sure how to apply the stripslashes function in the format it's in. Here is what my variables look like: {$t['firstname']} {$t['lastname']} etc... I tried this but doesn't seem to work, I'm probably just putting it in the wrong place? {stripslashes($t['firstname']);} How to I remove slashes from a variable like the above? Thanks.
stripslashes only removes back slashes. If you have 'display errors' turned on and you don't see any errors, that means you're using stripslashes() correctly, it just doesn't have anything to strip. If it's forward slashes you're removing, using a preg_replace() function.
Yes, it's forward slashes, but I'm pretty sure I used it on another variable (stripslashes) and it worked. It was in a different format though. stripslashes($variable); rather than the above.
Please give us all the line. If for example the code are something like: $sql = "SELECT * FROM people WHERE name = '{$t['firstname']}'"; You need to replace the code to: $sql = "SELECT * FROM people WHERE name = '".stripslashes($t['firstname'])."'"; So you can't do something like: $sql = "SELECT * FROM people WHERE name = 'stripslashes({$t['firstname']})'";