Simple Terms and Condition Dialog in PHP

Simple Terms and Condition Dialog is a simple PHP application. This application creates a dialog to prompt the user if he/she agreed to the Terms and Condition of the websites. If the user doesn't agree on the Website conditions they can't proceed or enter the website without enabling the submit button by clicking the agree button.

Sample Code

Index.php - This is for the UI of the dialog and for the other functions of the application.
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title></title>
  5. <link href='css/style.css' rel='stylesheet' type='text/css'/>
  6. <script src="js/jquery.min.js"></script>
  7. </head>
  8. <body>
  9. <div class="container">
  10. <h1 align="center">Terms and Condition!</h1><hr>
  11. <div class="license">
  12. Introduction
  13. These Website Standard Terms and Conditions written on this webpage shall manage your use of this website. These Terms will be applied fully and affect to your use of this Website. By using this Website, you agreed to accept all terms and conditions written in here. You must not use this Website if you disagree with any of these Website Standard Terms and Conditions.
  14.  
  15. <br><br>Minors or people below 18 years old are not allowed to use this Website.
  16. </div>
  17. <table>
  18. <tr>
  19. <td><input type="radio" name="terms" value="agree" id="agree"></td>
  20. <td>I Agree With The Terms And Condition.</td>
  21. </tr>
  22. <tr>
  23. <td><input type="radio" name="terms" value="not_agree" id="not_agree" checked></td>
  24. <td>I Do Not Agree With The Terms And Condition.</td>
  25. </tr>
  26. <tr>
  27. <td><br/></td>
  28. </tr>
  29. <tr>
  30. <td><input type="submit" name="submit" value="Submit" id="submit"></td>
  31. <td><input type="button" name="cancel" value="Cancel"></td>
  32. </tr>
  33. </table>
  34. </div>
  35. </body>
  36. </html>
This short script is for the function and condition of the application from the button to enable.
  1. <script type="text/javascript">
  2. $(function(){
  3. var btnSubmit = $('#submit');
  4. btnSubmit.attr('disabled', 'disabled');
  5. $('input[name=terms]').change(function(e){
  6. if($(this).val() == 'agree'){
  7. btnSubmit.removeAttr('disabled');
  8. }else{
  9. btnSubmit.attr('disabled', 'disabled');
  10. }
  11. });
  12. });
  13. </script>
Hope that you learn in this simple tutorial. Don't forget to LIKE & SHARE this website.

Add new comment