PHP Code help.

07/03/2013 23:53 Rappelz-Zesua#1
Hello, I have this webpage and it's very annoying I want the 'Buy' button to disappear once clicked but everything I try never works!

So if anybody could help please... I will be very appreciative! The button I want to disappear is in red.

Code:
if(is_promo($identificateur)){
$price=$item_price_p;
}else{
$price=$item_price;
}

}

if($cash>=$price){
$fenetre_deter='<td width="50"><img src="image/icon_success.gif" width="44" height="44" /></td>
                      <td align="left" class="warning">You have enough Donation Points.<br />
    							Would you like to buy this item?</td>';
[COLOR="Red"][B]$btn_achat_recharge='<a href="transaction.php?comfirm=1&id='.$identificateur.'&categorie='.$_GET['categorie'].'&page='.$_GET['page'].'"><img src="image/EN/button_buy_on.gif" width="81" height="32" border="0"</a>';[/B][/COLOR]
$_SESSION['comfirmation_achat']=$identificateur;
}else{
$fenetre_deter='<td width="50"><img src="image/icon_warning.gif" width="44" height="44" /></td>
                      <td align="left" class="warning">You do not enough Donation Points to buy this item.<br />
    							Would you like to buy more Donation Points?</td>';
$btn_achat_recharge='<a href="" target="_blank"><img src="image/EN/button_buy02.gif" width="81" height="32" border="0" /></a>';
}


require('file03.php');
}
?>
07/04/2013 16:50 telcy#2
You have to use some Javascript Code and maybe set some states as data attributes,
if you want manipulate your DOM elements without refreshing the whole site.

If you wanna use JQuery (I prefer) take a look at this:
[Only registered and activated users can see links. Click Here To Register...]

And add a attribute to your buttons like:
data-state="1"
07/04/2013 18:53 Rappelz-Zesua#3
Quote:
Originally Posted by telcy View Post
You have to use some Javascript Code and maybe set some states as data attributes,
if you want manipulate your DOM elements without refreshing the whole site.

If you wanna use JQuery (I prefer) take a look at this:
[Only registered and activated users can see links. Click Here To Register...]

And add a attribute to your buttons like:
data-state="1"
I did this it didn't work well for me, doesn't work I don't know what it is... Most probably I am just to noobie, haha.
07/05/2013 00:05 Veyd#4
jQuery

Code:
<head>
    <script src="http://code.jquery.com/jquery-1.5.js"></script>
</head>
<body>
    <button>Hide me!</button>
    <script>
        $("button").click(function () {
            $("button").hide();
        });   
    </script>


bad but work:
Code:
<head>
    <script src="http://code.jquery.com/jquery-1.5.js"></script>
</head>
<body>
    <form>
        <input type="submit" />
    </form>
    <script>
        $('form').submit(function(){
            $('input[type=submit]', this).val('uploading ... ').attr('disabled',true);
        });
    </script>
</body>
the last code makes the button "for ever" disabled when you dont have any refresh.

:handsdown:
07/11/2013 20:32 Rappelz-Zesua#5
bump still not worked it out. lol
07/11/2013 22:33 xEncounter#6
what exactly does not work ?

Every solution here should work..
07/12/2013 02:22 Looh#7
PHP Code:
<head>
    <
script src="http://code.jquery.com/jquery-1.5.js"></script>
</
head>
<
body>
    <
form>
        <
input type="submit" />
    </
form>
    <
script>
        $(
'form').submit(function(){
            $(
'input[type=submit]', this).val('uploading ... ').attr('disabled',true);
        });
    </
script>
</
body> 
Whats wrong, or whats bad with this?
07/12/2013 13:18 MartPwnS#8
Try to add Document ready function normaly not needed but give it a try.
Quote:

<head>
<script src="http://code.jquery.com/jquery-1.5.js"></script>
</head>
<body>
<form>
<input type="submit" />
</form>
<script>
$(document).ready(function() {
$('form').submit(function(){
$('input[type=submit]', this).val('uploading ... ').attr('disabled',true);
});
});
</script>
</body>
Kind Regards
MartPwnS
07/14/2013 17:15 BigM'#9
Could you print the error logged by Firefox in his web-console or any other similar browser? And make sure that JS is enabled in your browser!
07/14/2013 22:20 Rappelz-Zesua#10
The problem I have with it is I am really not good at writing stuff like this, Examples don't really help me(So it's written out into my code is the only way I will get it to work) Again Sorry about being so nooby