rendered paste body // A function to find the total number of chapters, and list the chapters by name. function chapters($content) { $subArray = $this->returnSubStrings($content, "<TD ALIGN='RIGHT'>", "</select></TD></TR></TABLE>"); $subStr = $subArray[0]; $chapters[0] = substr_count($subStr, '<option value') + 1; $X = 1; while($x <= $chapters) { $firstSub = ($x==1) ? "<option value=".$x." selected>".$x.". " : "<option value=".$x." >".$x.". "; $subArray = $this->returnSubStrings($subStr, $firstSub, "<option value"); $tempName = $subArray[0]; $chapters[1][$x] = $tempName; $X++; } return $chapters; }