Click to See Complete Forum and Search --> : Help with go to TOP anchor link


vicpal25
01-27-2005, 05:08 PM
Hello!
I am having determening on where to place a top anchor for the following directory listing


while(odbc_fetch_row($result))

{
$title=odbc_result($result,1);
$firstname =odbc_result($result,2);
$middlename=odbc_result($result,3);
$lastname=odbc_result($result,4);
$position=odbc_result($result,5);
$positiondesc=odbc_result($result,6);
$orgname=odbc_result($result,7);
$address1=odbc_result($result,8);
$address2=odbc_result($result,9);
$city=odbc_result($result,10);
$state=odbc_result($result,11);
$zip=odbc_result($result,12);
$phonetype1=odbc_result($result,13);
$phonenumber1=odbc_result($result,14);
$phonetype2=odbc_result($result,15);
$phonenumber2=odbc_result($result,16);
$email1=odbc_result($result,17);
$email2=odbc_result($result,18);
$category=odbc_result($result,19);
$description=odbc_result($result,20);

if (!$positiondesc == "") {

$anchorlink = $positiondesc;

if ($tempanchor != $anchorlink) {
print("<h3><a name=\"$anchorlink\"></a>".strtoupper($anchorlink)."</h3>\n");
}


print("<p>\n");
print("<strong>$title ");
print("$firstname ");
print("$middlename ");
print("$lastname</strong>");
print("<br/>\n");
print("$orgname");
print("<br />");
print("$address1");
if (!$address2 == "") {
print("<br/>\n");
print("$address2");
}
print("<br />\n");
print("$city,");
print("$state ");
print("$zip");
print("<br />\n");
print("$phonetype1 Phone: ");
print("$phonenumber1");
print("<br />\n");
print("$phonetype2 Phone: ");
print("$phonenumber2");
if ($email1=="") {
print("<br/>\n");
print("$email2");
}
else {
print("<br/>\n");
print("$email1");
}
print("<br />\n");
print("$category");
print("<br />\n");
print("$description");


if ($tempanchor != $anchorlink) {
print("<h3><a name=\"$anchorlink\"></a>".strtoupper($anchorlink)."</h3>\n");
}

$tempprofession = $positiondesc;
$tempanchor = $anchorlink;
}

}


this outputs the following results
http://www.pepperdine.edu/estateandgift/pepnet/membership/dir-profession2.htm

I need a top link that will take you the top of the page after the end of each listing list for ATTORNEY, CPA, FINANCIAL CONSULTANT/ADVISOR, etc. Can anyone direct me in the right way? Thanks!

P.S. I already have the top lists going to their proper anchor as you notice dynamically, i just need the go to TOP anchor list at the end of each stack of listing..:) thanks once again!

ShrineDesigns
01-27-2005, 05:15 PM
insert this after <body><a id="top" name="top"></a>the link to use to go to the page top<a href="<?php echo $_SERVER['REQUEST_URI']; ?>#top" onclick="window.scroll(0,0);this.blur();return false;">top of page</a>

vicpal25
01-27-2005, 05:19 PM
I need to have a top link after evey stack of Profession so I would have a total of 10. That would create only 1 single top link wouldnt it?

ShrineDesigns
01-27-2005, 05:38 PM
why do you use odbc_result() when you are using odbc_fetch_row()?

try thiswhile($row = odbc_fetch_row($result))
{
list($title, $firstname, $middlename, $lastname, $position, $positiondesc, $orgname, $address1, $address2, $city, $state, $zip, $phonetype1, $phonenumber1, $phonetype2, $phonenumber2, $email1, $email2, $category, $description) = $row;

if(!empty($positiondesc))
{
$anchorlink = $positiondesc;

if($tempanchor != $anchorlink)
{
echo "<h3><a name=\"$anchorlink\"></a>".strtoupper($anchorlink)."</h3>\n";
}
echo "<p><strong>$title $firstname $middlename $lastname</strong><br />\n$orgname<br />\n$address1";

if(!empty($address2))
{
echo "<br />\n$address2";
}
echo "<br />\n$city,$state $zip<br />\n$phonetype1 Phone: $phonenumber1<br />\n$phonetype2 Phone: $phonenumber2";

if(empty($email1))
{
echo "<br/>\n$email2";
}
else
{
echo "<br/>\n$email1";
}
echo "<br />\n$category<br />\n$description";

if($tempanchor != $anchorlink)
{
echo "<h3><a name=\"$anchorlink\"></a>".strtoupper($anchorlink)."</h3>\n");
}
// top of page
echo "<a href=\"{$_SERVER['REQUEST_URI']}#top\" onclick=\"window.scroll(0,0);this.blur();return false;\">top of page</a>";

$tempprofession = $positiondesc;
$tempanchor = $anchorlink;
}
}