Get-type links won't complete querystring values
| From: | Alberto Brea | Date: | Wed, 04 Dec 2002 22:16:06 +0000 |
| Subject: | Get-type links won't complete querystring values | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-127044@lists.php.net to get a copy of this message | ||
Hi everyone.
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.
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
next two the section, etc.
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.
Now, the generated URLs show incomplete, e.g.
http://localhost/e_ley.php?incl=sptmlaw0&navlinks=navsec&tit=03&ch=02&sec=
The variable $r doesn't fill the value for "sec=" so the link won´t work.
If I comment out the $r definition the page does show the list but the links don't work.
If I remove the // the page just won't show at all (error message).
My code so far is this:
<?php
//PRINT TABLE OF CONTENTS FOR CURRENT CHAPTER
$heading="1".$tit.$ch."0000000";
print("<center><b>");
print("$textos[$heading]");
print("</b></center><br>");
$keys= array_keys($textos);
foreach($keys as $h):
$l=substr($h,3,2); //CHAPTER NUMBER
$m=substr($h,1,2); //TITLE NUMBER
$n=substr($h,8,4);
// $r=substr($h,5,2); //SECTION NUMBER
$k=substr($h,7,1); //SECTION HEADING (NUMBER/TITLE/TEXT)
$s=substr($h,8,2); //SUBSECTION NUMBER
$t=substr($h,10,2); //LETTER ITEM NUMBER
if($m==$tit && $l==$ch && $r==$sec && $n=="0000"):
if($k=="1"):
print("<a href=$PHP_SELF?incl=sptmlaw0&");
print("navlinks=navsec&tit=$m&ch=$l&sec=$r>");
print("$textos[$h]");
print("</a> - ");
elseif($k=="2"):
print("$textos[$h]<br>");
endif;
endif;
endforeach;
?>
Could anybody help?
Thanks in advance
Alberto Brea
http://estudiobrea.com