Questions tagged [stripslashes]

A PHP library function for un-quoting a quoted string or paraphrased stripping slashes from a string. Questions are about the workings or issues with the stripslashes function.

Un-quotes a quoted string. The function returns a string with backslashes stripped off. (\' becomes ' and so on.) Double backslashes (\) are made into a single backslash ().

Example (from PHP manual)

<?php
$str = "Is your name O\'reilly?";

// Outputs: Is your name O'reilly?
echo stripslashes($str);
?>

Links

108 questions
2
votes
2 answers

Why check if stripslashes function exists?

I've found the following code that checks if the stripslashes() function exists. if ( function_exists( 'stripslashes' ) ) { // Do something } else { // Do something } The stripslashes() function works on PHP4 and PHP5, so I wonder why it…
Unix
  • 1,358
  • 3
  • 14
  • 23
2
votes
2 answers

mysql_real_escape_string, stripslashes and htmlspecialchars

When I post a variable to the database, of course, I use mysql_real_escape_string. This way special characters go in the database as it should. When I read this variable out of the database, I use mysql_real_escape_string again together with…
1
vote
5 answers

php stripslashes leaves one slash

Like the subject says I have some $_POST data that I need to strip all slashes from. However, it leaves behind one and when there are errors on the form it prints the post data back to the user so they do not have to re-enter it. When they submit…
Pengume
  • 550
  • 11
  • 27
1
vote
4 answers

Using stripslashes on a database row php

{$row['info']} How do I use stripslashes() php function on this? I've tried : stripslashes({$row['info']}), doesnt work and this: {stripslashes($row['info'])} Neither work. Do I have to use a $var first?? Thanks
yoyo
  • 11
  • 1
1
vote
5 answers

Do I really need to use mysql_real_escape_string when I save data in the DB?

I am using mysql_real_escape_string to save content in my mySQL database. The content I save is HTML through a form. I delete and re-upload the PHP file that writes in DB when I need it. To display correctly my HTML input I use stripslashes() In…
EnexoOnoma
  • 8,454
  • 18
  • 94
  • 179
1
vote
1 answer

Equivalent of PHP's stripslashes() in C?

was wondering if an Equivalent of PHP's stripslashes() in C existed?
user179169
1
vote
3 answers

I'm getting a semicolon error in PHP and can't understand why it's a problem

This is the error message: Parse error: syntax error, unexpected ';' in /home1/goldensu/public_html/camira/contactForm.php on line 155 and this is the code: $sendMessage = "Someone is interested in becoming a reseller or installer.
Nick Brunt
  • 9,533
  • 10
  • 54
  • 83
1
vote
0 answers

json_encode and the apostrophe

I'm building a WordPress plugin in PHP to let customers send push notifications to mobile apps using OneSignal. I have a function that is both form and datahandler in that the action is recursive:
Ed Tiley
  • 13
  • 6
1
vote
5 answers

How to strip slashes in Javascript (json)? Any JQuery plugin?

So, when I save the data into database, PHP will add a \ on single or double quotes. That is good. However, when data is passed back to the client using json_encode(); TEXT like McDonald's is STORED as McDonald's in the DB but once passed back…
murvinlai
  • 48,919
  • 52
  • 129
  • 177
1
vote
1 answer

Not able to remove backslash from below code?

below is my code the issue is that when i enter any username with apostrophe (') Additional character "\ backslash" is being displayed when Search results are returned. Below is my code i find that a function addslashes is used in the checkusername…
leuage
  • 566
  • 3
  • 17
1
vote
1 answer

Sort SQL ORDER BY query without slashes in front of escaped characters

I am trying to figure out how to sort an SQL query by Last Name. This is working except in the case of where a customers last name has a special character. For example O'Maley. If this last name is sorted with a last name of "Omar" for example the…
Todd
  • 11
  • 1
1
vote
0 answers

ID with slashes in Codeigniter route/controller

I have this route in Codeingniter $route['([en|fr|es|it]+)/(.+)'] = 'My_Controller/index/$1/$2'; where first argument is a lang id and second is an unique iD. The ID has slashes in its format like: item/34/public …
vicmontol
  • 139
  • 6
1
vote
0 answers

twig add filter stripslashes (no framework)

In my database I have escapde each string with addslashes http://php.net/manual/fr/function.addslashes.php Now I want to "unescape" my data with stripslashes to display them in a twig view http://php.net/manual/fr/function.stripslashes.php I'm not…
Leinox
  • 279
  • 1
  • 3
  • 10
1
vote
1 answer

stripslashes and special characters?

My xml feed file is using stripslashes, but I also want to remove special characters from som fields - how would I do that and where/what order would I add it? $output .= "
".htmlentities(html_entity_decode(stripslashes($row->street_num)))."…
Jason
  • 7,612
  • 14
  • 77
  • 127
1
vote
2 answers

How to add stripslashes to get_option()

Hy, I created a WordPress Theme using a lot of custom options. While saving the options in the backend amongst other things I'm adding backslashes before characters that need to be escaped. Such as ' and ". Now I need to remove them before…
Nico Martin
  • 1,268
  • 1
  • 14
  • 23