Hi,
Thursday, December 5, 2002, 8:16:06 AM, you wrote:
AB> Hi everyone.
AB> I have certain links for document navigation with a query string where one of the
values doesn't fill, so the links don't work.
AB> The document is a law navigated with pieces of text taken from an array, where the
key is a 12-digit string. The key's first three figures identify each law title, the
two next the chapter, the
AB> next two the section, etc.
AB> The code with the problem is an include that shows a list of sections in each
chapter. Each section name in the list is a get-type link to the relevant section
contents.
AB> Now, the generated URLs show incomplete, e.g.
AB> http://localhost/e_ley.php?incl=sptmlaw0&navlinks=navsec&tit=03&ch=02&sec=
AB> The variable $r doesn't fill the value for "sec=" so the link won´t work.
AB> If I comment out the $r definition the page does show the list but the links don't
work.
AB> If I remove the // the page just won't show at all (error message).
AB> My code so far is this:
AB> //PRINT TABLE OF CONTENTS FOR CURRENT CHAPTER
AB> $heading="1".$tit.$ch."000";
AB> print("");
AB> print("$textos[$heading]");
AB> print("");
AB> $keys= array_keys($textos);
AB> foreach($keys as $h):
AB> $l=substr($h,3,2); //CHAPTER NUMBER
AB> $m=substr($h,1,2); //TITLE NUMBER
AB> $n=substr($h,8,4);
AB> // $r=substr($h,5,2); //SECTION NUMBER
AB> $k=substr($h,7,1); //SECTION HEADING (NUMBER/TITLE/TEXT)
AB> $s=substr($h,8,2); //SUBSECTION NUMBER
AB> $t=substr($h,10,2); //LETTER ITEM NUMBER
AB> if($m==$tit && $l==$ch && $r==$sec && $n==""):
AB> if($k=="1"):
AB>print("print("navlinks=navsec&tit=$m&ch=$l&sec=$r>");
AB>print("$textos[$h]");
AB>print(" - ");
AB> elseif($k=="2"):
AB>print("$textos[$h]");
AB> endif;
AB> endif;
AB> endforeach;
?>>
AB> Could anybody help?
AB> Thanks in advance
AB> Alberto Brea
AB> http://estudiobrea.com
I think you need to note that substr() starts at 0 not 1
--
regards,
Tom
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php