Jump to content

Jump to a paragraph on a php-page


mollemus

Recommended Posts

Hello!

 

Looked around the forum, but didn't really know what to search on, I need

to have the effect you can do with html, <a href="index.html#text1"> but on

a php-page.

 

I have an index.php which generates a html-page with content from a database,

and I want the user to be forwarded to the right section of this page.

 

As it is now, i allready send two variables "index.php?lessonNr=1&chapterNr=1" but

I also want to specify a section of the page. Tried "index.php?lessonNr=1&chapterNr=1#text1"

but this obviously doesn't work.

 

Can anyone help me?

 

Thx

Link to comment
https://forums.phpfreaks.com/topic/48754-jump-to-a-paragraph-on-a-php-page/
Share on other sites

Hmm... this doesn't work for me, my index.php seems to get the variables for lessonNr

and chapterNr confused with the #text1 that is sent to it.

 

lessonNr and chapterNr ends up having no value, and the page becomes empty.

 

I've written the index.php so that it writes out <a name="text1">, "text2" ... and so forth

for each block of text it writes out.

you don't need a named anchor anymore

 

give each paragraph an id (and make sure each is unique and doesn't start with a number - i am using p1, p2 etc for this example);

 

then any 'jump to' links in your page will only have to be <a href="#p7" title="Jump to paragraph 7">Paragrapgh 7</a>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.