doubledee — 2011-08-03T21:31:20-04:00 — #1
I am building an "Add a Comment" section at the end of each article page I write.
The articles usually are several pages long.
Once a user logs-in/registers, how can I bring them back to where the Comments section is at the bottom of the page?
(I want them to be able to instantly add a comment and not have to scroll.)
ffcus — 2011-08-03T21:43:50-04:00 — #2
Can you pass the page number and anchor name in the query string during the log in process and then redirect the user to the page in the querystring after a successful log in?
When they try to comment but are not logged in:
<a href="login.php?returnurl=article7.php#comment">Login to Comment</a>
So after they log in, you would just need to redirect them to "article7.php#comment"
doubledee — 2011-08-03T21:54:46-04:00 — #3
Well, the way I am doing it is this... (Even though this is PHP)
- User lands on "article1234.php"
- System sets SESSION with page's filename and path
- User either logs in or registers
- On Log-In page, the page accesses the article's filename/path and redirects them there.
Back to my question...
So I need an HTML anchor to do what I want as far as scrolling down?
What the HTML to do that?
Maybe I can append whatever to my Session variable? :-/
ffcus — 2011-08-03T22:27:38-04:00 — #4
So you already had the hard part worked out
Place an anchor at the spot on the page that the Comments section starts.
Then if you redirect your user to "article1234.php#comment" you will be right there.
Here is the w3schools area to tinker with
Tryit Editor v1.4
doubledee — 2011-08-03T23:12:47-04:00 — #5
system — 2011-08-04T06:02:58-04:00 — #6
You can also target ID's the same way, so rather than stuffing some pointless empty anchor in there, put an ID on the element you want and then target it just like you would name.
ffcus — 2011-08-04T16:01:25-04:00 — #7