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
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.

Link to comment
Share on other sites

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>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.