I've got a script that paginates long articles into multiple pages. The article stored in the db has this code inserted where page breaks are supposed to happen: <p>[PAGE1]</p> content <p>[PAGE2]</p> etc. This all works fine and I don't need any changes here but what I do need to do is create a print version of the article which would effectively display the entire text for the article and remove any instances of <p>[PAGE1]</p>, etc. If anyone could help me with this I would really appreciate it. The code for doing the page breaks looks like this: //break article into pages if there are pages $originaltext = $row_rs['content']; $total=substr_count($originaltext,"[PAGE"); if ($_GET['pg'] && $_GET['pg']<$total+1) { $i=$_GET['pg']; } else { $i=1; } // Next page $k=$i+1; $page="[PAGE".$i."]"; $nextpage="[PAGE".$k."]"; $start=strpos($originaltext,$page); $start=$start+strlen($page)+1; $end=strpos($originaltext,$nextpage); $length=$end-($start+$pagesize); $totalpages = $total; if ($i==$total) { $text=substr($originaltext,$start); } else { $text=substr($originaltext,$start,$length); } //Removes end of </p> tag from page numbers $text = substr($text,3);