skendo Posted August 5, 2011 Share Posted August 5, 2011 Dear friends i am new on php. Can some one tell me how can i make. When users earning is 5.00 The button to be enabled.?! Quote Link to comment Share on other sites More sharing options...
Maq Posted August 5, 2011 Share Posted August 5, 2011 Huh? Quote Link to comment Share on other sites More sharing options...
Philip Posted August 5, 2011 Share Posted August 5, 2011 Hope this reply is not too late for others who are also seeking for a same help. Quote Link to comment Share on other sites More sharing options...
voip03 Posted August 5, 2011 Share Posted August 5, 2011 Quote Link to comment Share on other sites More sharing options...
skendo Posted August 5, 2011 Author Share Posted August 5, 2011 I am working on a script banner exchange. For example when user has earned 5.00 that is limit the button to be enable for requesting money. Quote Link to comment Share on other sites More sharing options...
voip03 Posted August 5, 2011 Share Posted August 5, 2011 <? if($earns >5 ) { echo "request money"; } else { echo "you can't request money";} ?> Quote Link to comment Share on other sites More sharing options...
skendo Posted August 5, 2011 Author Share Posted August 5, 2011 thanks what about the eanble disablebutton part when equal 5? Quote Link to comment Share on other sites More sharing options...
radiations3 Posted August 5, 2011 Share Posted August 5, 2011 You can easily do it with javascripting.. <script type="text/javascript"> function dis_ena_submit() { if(document.acc_ctrl.add_access.options[0].selected ¦¦ document.acc_ctrl.add_assoc.options[0].selected) { //Disables submit button document.forms[0].grant_button.disabled=true; } else { //Enables submit button document.forms[0].grant_button.disabled=false; } } </script> Quote Link to comment Share on other sites More sharing options...
skendo Posted August 5, 2011 Author Share Posted August 5, 2011 if(document.acc_ctrl.add_access.options[0].selected ¦¦ document.acc_ctrl.add_assoc.options[0].selected) Shows error Quote Link to comment Share on other sites More sharing options...
radiations3 Posted August 5, 2011 Share Posted August 5, 2011 try this one and modify the following code according to your form fields name and the like because enable and disabling functionality is a good approach through javascripting <script type="text/javascript"> { if (...) // some logic to determine if it is ok to go {document.getElementById("xx").disabled = false;} else // in case it was enabled and the user changed their mind {document.getElementById("xx").disabled = true;} } </script> ... <input type="button" id="xx" disabled ...> Quote Link to comment Share on other sites More sharing options...
skendo Posted August 5, 2011 Author Share Posted August 5, 2011 thanks Quote Link to comment Share on other sites More sharing options...
radiations3 Posted August 5, 2011 Share Posted August 5, 2011 thanks If you topic is solved then mark it to be solved!!!! Quote Link to comment Share on other sites More sharing options...
.josh Posted August 5, 2011 Share Posted August 5, 2011 try this one and modify the following code according to your form fields name and the like because enable and disabling functionality is a good approach through javascripting Yeah, because users totally can't just disable javascript or change the enable/disable flag or similar. OP, do not do something like this. Or at least, make sure you also output a message explaining that the user cannot submit unless they reach 5. And also do NOT just blindly process the form submit by virtue of it being submitted. If you output a disabled button and then assume that the amount is at least 5 by virtue of the user being able to submit (button not disabled), the user can easily alter the client-side html/javascript to enable it and submit! Quote Link to comment 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.