-2

という名前のテキスト領域の内容を印刷したいと思いますtext。この機能については知っていwindow.print()ますが、それを使用すると、Web ページ全体を印刷することしかできません。ただし、必要なのは、その特定のテキストエリアの内容のみを印刷することです...

私のコードは以下のとおりです。

<?php 
$sq="SELECT * FROM $db->db_schema.visit_reg where patient_id=$user_id and complaint_id=$complaint_id";
$result=$db->query($sq);
echo "<textarea name='text' rows='4' cols='47' >";
echo $result[0]['prescription']; 
echo "</textarea>"; 
?>

繰り返しますが、Web ページ全体ではなく、そのテキストエリアの内容のみを印刷したいと思います。

4

1 に答える 1

1

php ストリップ タグを使用できます。指定された文字列から php および html タグが削除されます。

echo strip_tags($result[0]['prescription']); //it will print text only.

http://php.net/manual/en/function.strip-tags.php

于 2013-08-16T11:45:09.957 に答える