September 10, 200620 yr The test site I'm trying this out on, and the actual page I'm going on about is here: See Example and by the way - this site is no way finished... I've got a guestbook script that I've positioned at the bottom of the page so that people can add comments about the artists ideas etc and I'm having problems with it. One of the main defined variables within the script is: define('SELF', $_SERVER['PHP_SELF']); If you click on 'View Entries' or 'Add a Comment' on the page the script uses this for instance: echo '<p><a href="'.SELF.'" class="bluebold" title="Click here to View Entries">View Entries</a> .: or :. <a href="'.SELF.'?func=sign" class="bluebold" title="Click here to Add a Comment">Add Comment</a><br /><hr /> </p>'; echo '<!-- guestbook -->'; The problem I've got is that when you click on 'View Entries' or 'Add Comment' the page is refreshed and goes back to the top and so you have to scroll down to the guestbook area - add a cooment or click view entries to see what I mean. Joe Bloggs out there might not realise this and think there is something wrong with the page, so I thought, why not add an anchor to the guestbook area and this would solve the problem. But guess what - I have no idea how to do this and all my efforts and ideas have messed things up. It would be ideal to add the anchor within the defined variable "define('SELF', $_SERVER['PHP_SELF']);" at the top of the code and then it's generic to every main link. Any ideas? Need more code info? let me know...
September 10, 200620 yr You could create an anchor at View entries called entries. And then the link to "View Entries" could be guestbook.php#entries Is that the sort of thing you mean ?
September 10, 200620 yr Author Not really As there are several links and they all use the variable defined 'SELF'. I don't fancy going into the code and adjust every single link so I thought it might be possible to define it globally when the main variables are defined. Maybe you need to look at the file to understand what I mean. I think I've attached it OK. sketchbook01.php p.s. - I'll probably delete the file once I've got a solution if that's OK
February 21, 200719 yr define('SELF', $_SERVER['PHP_SELF']); Any ideas? Need more code info? let me know... Have you tried something like... define('SELF', $_SERVER['PHP_SELF'] . '#guestbook_id'); This should work for the View link... the other one will be tricky cos' of the querystring on the end!
Create an account or sign in to comment