2010年04月17日 過去Blog
# stripcslashes() —- C言語と同様にバックスラッシュでクォートされた文字列を元に戻す # htmlentities() —- 適用可能な文字を全てHTML エンティティに変換する # nl2br() —- 改行文字の前にHTMLの改行タグを挿入する # strip_tags() —- 文字列からHTMLタグ、および PHPタグを取り除く
$text はフォームから受け取る文字列。 // HTML文字のエスケープ $text = htmlspecialchars( $_POST[“messege”] ); // magic_quotes_gpcの値がONなら削除 if ( get_magic_quotes_gpc() ) { $text = stripslashes( $text ); } // 改行処理 $text = nl2br($text); print_r($text); これでフォームから送信された文章内の改行をそのまま表示させることが出来る。

この投稿へのコメント

コメントはまだありません。

コメントを残す

メールアドレスが公開されることはありません。

次のHTML タグと属性が使えます。
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

CAPTCHA


ピックアップ記事

データベースから重複データを削除して表示する

2010年03月25日 過去Blog
重複行を除いて表示したい場合は、select distinctを使用する SELECT DISTINCT [, 列名2 ...] FROM [WHERE条件式など] ※※ は必須、[]はオプション
「データベースから重複データを削除して表示する」をはてなブックマークに追加

objective-C 日時関連

2011年04月28日 過去Blog
http://d.hatena.ne.jp/KishikawaKatsumi/20081121/1227275688 http://unicode.org/reports/tr35/tr35-6.html#Date_Format_Patterns
「objective-C 日時関連」をはてなブックマークに追加

PHP 配列の並び替え

2010年05月21日 過去Blog
asort ($res_get_email,SORT_STRING); sort (配列,パラメータ); このパラメータを次の3つから選択することで並べ方をコントロールすることができます。 SORT_REGULAR - 通常通りに項目を比較 SORT_NUMERIC - 数値的に項目を比較 SORT_STRING - 文字列として項目を比較 参考URL:http://w1.nirai.ne.…
「PHP 配列の並び替え」をはてなブックマークに追加

Drupal6でクリーンURL

2011年04月25日 過去Blog
.htaccessに以下を記述してルートに設置 # Various rewrite rules. <IfModule mod_rewrite.c>   RewriteEngine on   # Modify the RewriteBase if you are using Drupal in a subdirectory and   # the rewrite rules are n…
「Drupal6でクリーンURL」をはてなブックマークに追加

PHP strstr stristr ある文字列が含まれるかどうか調べる

2010年06月11日 過去Blog
$string = 'Hello World!'; if(stristr($string, 'earth') === FALSE) { echo '"earth" not found in string'; } // 出力は "earth" not found in string となります 参照元:http://www.php.net/manual/ja/function.st…
「PHP strstr stristr ある文字列が含まれるかどうか調べる」をはてなブックマークに追加
© graffiti on the web . All rights reserved. WordPress Theme by comfy