Log in

View Full Version : ifames and anchor tags



shill
05-16-2006, 12:17 AM
New to PHP: will not feel bad if you let me know how terrible my syntax is:rolleyes:

I have an iframe that pulls info from the GET request.
my url looks something like this: http://www.mywebsite.com/index.php?file=main.html

The code for index:
<iframe src="<?php echo(htmlentities($_GET['file'])); ?>

This works great. (by the way unfortunately I HAVE to use the iframe)

Now I have added some anchor tags inside of main.html
the code looks like this:
<a name="anchor"></a>

this Does not work:
http://www.mywebsite.com/index.php?file=main.html#anchor

nor,

http://www.mywebsite.com/index.php?file=main.html&#anchor

nor,
http://www.mywebsite.com/index.php?file=main.html&anchor

nor,
code for index:
<iframe src="<?php echo(htmlentities($_GET['file','page'])); ?>
url: http://www.mywebsite.com/index.php?file=main.html&page=#anchor

Any suggestions would be appreciated.
Thnx

cybercoder
05-20-2006, 04:49 PM
Your site doesn't appear to be hosted at that location.

jscheuer1
05-20-2006, 04:58 PM
I have an iframe that pulls info from the GET request.
my url looks something like this: http://www.mywebsite.com/index.php?file=main.html


Your site doesn't appear to be hosted at that location.

Please read the posts more carefully before responding with garbage.

cybercoder
05-20-2006, 05:01 PM
Please read the posts more carefully before responding with garbage.

I don't appreciate this abuse!

How are we suppossed to help properly without an example. That is all I was trying to get across.

jscheuer1
05-20-2006, 05:10 PM
I don't appreciate this abuse!

How are we suppossed to help properly without an example. That is all I was trying to get across.

Then be more clear. Something like:

Please post a link to the page on your site that contains the problematic code so we can check it out.

Would do.

Otherwise, it appears as though you have your head up somewhere.

wheller
06-05-2006, 07:42 PM
If you have not already solved this try...

url: http://www.mywebsite.com/index.php?file=whatever.html&anchor=anchor


<iframe src="<?php echo(htmlentities($_GET['file'])); ?>#<?php
echo(htmlentities($_GET['anchor'])); ?>">

djr33
06-05-2006, 10:32 PM
I believe the issue might be with the #. Since that specifies an anchor, it will look for that anchor on the current page.

As such, use the html character code instead of #, &&#35;35;
like this:
http://www.mywebsite.com/index.php?file=main.html&&#35;35;anchor

However, I wonder if that ampersand will now cause you issues, trying to split the variable in two.


The last post will do it. You can try that :)