Re: Quotation Marks in <textarea>...</textarea>

From: Date: Wed, 10 Oct 2001 13:55:16 +0000
Subject: Re: Quotation Marks in <textarea>...</textarea>
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-70659@lists.php.net to get a copy of this message
Hello KC, Just another comment: If you don't know about the magic_quotes_gpc setting on the server your script is supposed to be run on, use get_magic_quotes_gpc() to handle text data properly anyway. I usually use a function like this before I store submitted text data in a database: function SlashesIfNecessary ($varname) { $mq_gpc = get_magic_quotes_gpc(); if ($mq_gpc == 1) return $varname; else return addslashes($varname); } And then with each variable: $title = SlashesIfNecessary($title); $text = SlashesIfNecessary($text); If you display text data from the database on an HTML page again, don't forget something like htmlentities() (or htmlspecialchars()) and nl2br(). Best regards Tom

« previous php.general (#70659) next »