Riparian Posted September 19, 2009 Share Posted September 19, 2009 Scenario : One page with hundreds of items on it. Add an Item to the Cart and Page re-loads (Add to Cart uses hyperlink not form). Re-loaded page stops at the top of the page. Question : Is there a way that I can force the page to go back to the position it was at when the Add to Cart was clicked rather that scroll down dozens of pages each time. Any help is greatly appreciated Link to comment https://forums.phpfreaks.com/topic/174764-solved-jump-to-page-position-on-reload/ Share on other sites More sharing options...
knsito Posted September 19, 2009 Share Posted September 19, 2009 use an Anchor? Link to comment https://forums.phpfreaks.com/topic/174764-solved-jump-to-page-position-on-reload/#findComment-921006 Share on other sites More sharing options...
Riparian Posted September 19, 2009 Author Share Posted September 19, 2009 Thanks for the reply. I have tried this but the anchor would be defined before the loop and on re-load the anchor has not been defined... at least that is what seems to be happening when I have tried an anchor. Link to comment https://forums.phpfreaks.com/topic/174764-solved-jump-to-page-position-on-reload/#findComment-921021 Share on other sites More sharing options...
Riparian Posted September 19, 2009 Author Share Posted September 19, 2009 For those interested the named anchor did work... Thank Knitso Where I was going wrong was having the hyperlink Add to Cart like this (a href.....etc ) currentprogram.php#nametogot?var1=xx&var2=xx It should have been (a href.....etc ) currentprogram.php?var1=xx&var2=xx#nametogot Note the name anchor after the variables The <a name="<?=$row[model_number]?>"></a> was defined above the Add to Cart hyperlink Thanks for the interest Link to comment https://forums.phpfreaks.com/topic/174764-solved-jump-to-page-position-on-reload/#findComment-921024 Share on other sites More sharing options...
Riparian Posted September 19, 2009 Author Share Posted September 19, 2009 Please disregard all of the above.... the variables do not pass with the # at the end and the hyperlink does not work at the start. If anyone knows why please let me know Link to comment https://forums.phpfreaks.com/topic/174764-solved-jump-to-page-position-on-reload/#findComment-921026 Share on other sites More sharing options...
Riparian Posted September 19, 2009 Author Share Posted September 19, 2009 Sorry... works perfectly as described above.... my poor programming Link to comment https://forums.phpfreaks.com/topic/174764-solved-jump-to-page-position-on-reload/#findComment-921027 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.