Page 1 of 1

href problem

Posted: Tue Apr 03, 2007 8:36 pm
by daring1
Hi -

i have a main php page (mainpage.php) which loads another php page within it after clicking a link. (loadedpage.php).

My problem is all of the href links in the loadedpage.php are defaulting to the full url path of the parent page and then tacking the php variables i'm pulling in onto the end of it. In this occassion the variable being pulled from the database is the number 50.

So all of my anchor tags in the loadedpage.php which should just simply be: <a href=#50">, are now appearing as: <a href=http://myhomepage.com/mainpage.php?section=hottopics#50">.

All i want is the '#50'.

Here's an example of how the code looks: <a href="#<?=$htopicid?>">

Any help would be greatly appreciated....i just can't figure this out as to why it's doing it.

Thanks in advance.

Posted: Tue Apr 03, 2007 8:50 pm
by feyd
Can you post a live link to this?

Posted: Tue Apr 03, 2007 8:58 pm
by daring1
Hi feyd -

I PM'd the url to you...hope you don't mind...

Posted: Tue Apr 03, 2007 9:05 pm
by feyd

Code: Select all

<a href="#37">
ENCORE PALISADES</a>
</B></TD></TR><TR><TD style="font-size:10px;color:blue;"><B><a href="#40">
STATE OF THE TOWN-2007</a>
</B></TD></TR><TR><TD style="font-size:10px;color:blue;"><B><a href="#41">
Town of Haverstraw 2007 Summer Concert Series</a>
That's a copy directly from your page source. It's working correctly. What you are seeing is the browser's understanding of what the reference refers to.

Posted: Tue Apr 03, 2007 9:13 pm
by daring1
I added the target to the href. i realized when i undid some attempts at trying to fix the problem that i went back to far and removed the target tag.

the problem is when you now click the link the entire page is loading into the iframe and not just jumping to the anchor tag.

sorry about that. thanks for checking into it though!

Posted: Tue Apr 03, 2007 9:22 pm
by daring1
Fixed it. Turns out once you made me realize that the php was correct i knew there must've been something wrong with the actual link to the iframe which there was.

Here's how I corrected the problem:

<a href="hottopicscontent.php#<?=$htopicid?>" target="ifrm">

i needed to add the page name (hottopicscontent.php) of the iframe and then also target it. Works perfectly!

Thanks feyd for helping me figure this out! Much appreciated!