HTML & CSS
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.)
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"
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? :-/
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
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.
This topic is now closed. New replies are no longer allowed.