May 21, 2013

URL prevent href button action php

User222914’s Question:

Hi I have a href tag where I order an array values(up to down or down to up),so my problem is that when I click twice in the same button I have no action performed.That because of in my url I have something like that:
When I click for the 1st time on my button the action is done,but I click again on the same button nothing,but when I click ‘F5’ action the action is done:
Exemple in my URL when I click one time:

http://localhost/home/test.php?dir=down&keyword=1

The second time I click the URL remains the same but no action is done.it is done when I click on F5.

My hyperlink:

echo "<a href="$_SERVER[PHP_SELF]?dir=down&keyword=$keywordkey"><img src=web/images/remove.png /></a>";

How can I resolve this ?
Thank you!!!

After you click on the button for the first time, you give command to your script to sort it downwards.

Once this action is complete, you still have same command to provide to your script i.e. down

Since it is a same command going to the your code, is does exactly same thus, the results are also same.

Author: Nabin Nepal (Starx)

Hello, I am Nabin Nepal and you can call me Starx. This is my blog where write about my life and my involvements. I am a Software Developer, A Cyclist and a Realist. I hope you will find my blog interesting. Follow me on Google+

...

Please fill the form - I will response as fast as I can!