abemaca Posted November 2, 2011 Share Posted November 2, 2011 hi all. my issue is that im using php pages for my code and i cant get an anchor to work. im trying to get it to load the page half way down directly from a submit button. the section i want to be seen ive called CM so above that section i have <A NAME="CM"></A> and for my submit button i have added ???.php#CM to the URL but it loads like normal showing top of page. any help welcome. Quote Link to comment https://forums.phpfreaks.com/topic/250297-anchor-name-tag-issues-please-help/ Share on other sites More sharing options...
AyKay47 Posted November 2, 2011 Share Posted November 2, 2011 post the relevant code Quote Link to comment https://forums.phpfreaks.com/topic/250297-anchor-name-tag-issues-please-help/#findComment-1284287 Share on other sites More sharing options...
abemaca Posted November 2, 2011 Author Share Posted November 2, 2011 main page code is here blah blah <a name="cm"></a> this section i want to show .................................................................................... <form method="post" action="mypage.php?page=myview#cm"> <input name="test" type="text" id="test" size="80" value="" /></form> Quote Link to comment https://forums.phpfreaks.com/topic/250297-anchor-name-tag-issues-please-help/#findComment-1284295 Share on other sites More sharing options...
abemaca Posted November 3, 2011 Author Share Posted November 3, 2011 anyone ??? :'( Quote Link to comment https://forums.phpfreaks.com/topic/250297-anchor-name-tag-issues-please-help/#findComment-1284562 Share on other sites More sharing options...
abemaca Posted November 5, 2011 Author Share Posted November 5, 2011 IS THIS A HARD SUBJECT OR IS THIS FORUM GOING DOWN HILL RAPIDLY ??? no offense meant Quote Link to comment https://forums.phpfreaks.com/topic/250297-anchor-name-tag-issues-please-help/#findComment-1285353 Share on other sites More sharing options...
haku Posted November 6, 2011 Share Posted November 6, 2011 Submit buttons are used for submitting forms, they are not links. The reason you are having troubles is because you are trying to force the button to do something it doesn't do. Use an <a> tag if you want to link to somewhere else on the page. Quote Link to comment https://forums.phpfreaks.com/topic/250297-anchor-name-tag-issues-please-help/#findComment-1285423 Share on other sites More sharing options...
abemaca Posted November 6, 2011 Author Share Posted November 6, 2011 Submit buttons are used for submitting forms, they are not links. The reason you are having troubles is because you are trying to force the button to do something it doesn't do. Use an <a> tag if you want to link to somewhere else on the page. fair enough , so are you saying its impossible to submit a form and to load the same page (after submitting) in a specific location (like a link would) ??? Quote Link to comment https://forums.phpfreaks.com/topic/250297-anchor-name-tag-issues-please-help/#findComment-1285629 Share on other sites More sharing options...
haku Posted November 6, 2011 Share Posted November 6, 2011 My apologies, I didn't realize you wanted it to move to the hash after submitting the form. I thought you wanted to have it happen on the same page. Try just using the hash only as the action: <form action="#cm"> If that doesn't work, you could use a php header() call in your form processing, and redirect to the same page with the hashmark. This will give the added bonus of being able to reload the page without re-submitting the form values. Unfortunately, it will mean you can't use any data generated in your processing script in the same page - you will have to store it somewhere between the redirect. Quote Link to comment https://forums.phpfreaks.com/topic/250297-anchor-name-tag-issues-please-help/#findComment-1285643 Share on other sites More sharing options...
abemaca Posted November 6, 2011 Author Share Posted November 6, 2011 hmmmm ........... the page it self shows details at top of page , then half way down the user can comment , but when they submit there comment it loads the same page but from the top , ide like it to show there comments as soon as they post it (which is half way down that page) ...... this is the page ... notice the comments section is under the main part ..... when the enter there comment i want the page to load where the comments are like this ............ NOT like the 1st pic showing the top half also. Quote Link to comment https://forums.phpfreaks.com/topic/250297-anchor-name-tag-issues-please-help/#findComment-1285701 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.