note 46023 added to function.addslashes

From: Date: Mon, 27 Sep 2004 10:34:07 +0000
Subject: note 46023 added to function.addslashes
Groups: php.notes 
Request: Send a blank email to php-notes+get-77427@lists.php.net to get a copy of this message
I was stumped for a long time by the fact that even when using addslashes and stripslashes explicitly on the field values double quotes (") still didn't seem to show up in strings read from a database. Until I looked at the source, and realised that the field value is just truncated at the first occurrence of a double quote. the remainder of the string is there (in the source), but is ignored when the form is displayed and submitted. This can easily be solved by replacing double quotes with """ when building the form. like this: $fld_value = str_replace ( "\"", """, $src_string ) ; The reverse replacement after the form submission is not necessary. ---- Manual Page -- http://www.php.net/manual/en/function.addslashes.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+46023 Delete -- http://master.php.net/manage/user-notes.php?action=delete+46023&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+46023&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#77427) next »