Page 1 of 1

temporary disable button using php

Posted: Thu Dec 17, 2009 9:08 am
by Goofan
Ok, so i have researched some about disable a button and everyone says that u need to use js. now i dont know that much js so i wonderd if there is a way to do this in php only.
If not then please post a sample code that would temporary disable a button for "exampel 3 seconds".
This is ment to do:
example:
$rand = rand(0,10)
$brand = rand(0,10)
if ($brand == $rand)
{
$input = rand(7500,65000)
$sql="UPDATE konto SET pengar=$pengar + $input WHERE saved_id=$id";
$result = mysql_query($sql) or die(mysql_error());//Skicka info till tabell

header('Refresh: 3; url=refresh/two=two(main).php?saved_id='.$id);//Skickas till angiven sida. //and at the same time the button would be disabled


}

Re: temporary disable button using php

Posted: Thu Dec 17, 2009 1:20 pm
by requinix
Not all browsers respect the Refresh header. Find another way.

Spoiler: you won't find one. JavaScript is required for some part of it.

Re: temporary disable button using php

Posted: Thu Dec 17, 2009 11:15 pm
by daedalus__
dont be intimidated by js its easy.

http://www.google.com/search?q=disable+ ... javascript

http://www.google.com/search?q=create+a ... +javscript

im not sure what you are trying to describe with your example though.

they click the button, it updates the database then redirects them?

Re: temporary disable button using php

Posted: Fri Dec 18, 2009 4:08 pm
by Goofan
they click a button it randomize a number if they win they will be shown a message YOU WON!...
the problem is that when you win it redirect in a header "takes 3 seconds" but if u accidentaly click again this will not happend...


-Hope you understand
-Thomas

Re: temporary disable button using php

Posted: Fri Dec 18, 2009 4:11 pm
by daedalus__
okay i get it now. well follow those links and use javascript to do this. it's real easy i promise.

Re: temporary disable button using php

Posted: Fri Dec 18, 2009 5:33 pm
by Goofan
I will and thanks daed :D (again)