ghfghgh - PHP Online

Form of PHP Sandbox

Enter Your PHP code here for testing/debugging in the Online PHP Sandbox. As in the usual PHP files, you can also add HTML, but do not forget to add the tag <?php in the places where the PHP script should be executed.



Your result can be seen below.

Result of php executing





Full code of ghfghgh.php

  1. <html>
  2. <head><title></title></head>
  3. <body>
  4. <b>Заявка на получение ссуды. Кредитный банк Namllu</b>
  5. <?php
  6. if (isset($_POST['posted'])) {
  7. $duration = 0;
  8. switch ($_POST['loan']) {
  9. case "1000";
  10. $interest = 5;
  11. break;
  12. case "5000";
  13. $interest = 6.5;
  14. break;
  15. case "10000";
  16. $interest = 8;
  17. break;
  18. default:
  19. echo "Вы не выбрали вариант ссуды<hr>";
  20. exit;
  21. }
  22. while ($_POST['loan'] > 0)
  23. {
  24. $duration = $duration + 1;
  25. $monthly = $_POST['month'] - ($_POST['loan']*$interest/100);
  26. if ($monthly <= 0)
  27. {
  28. echo "Чтобы погасить ссуду, требуются более крупные
  29. ежемесячные платежи<hr>";
  30. exit;
  31. }
  32. $_POST['loan'] = $_POST['loan'] - $monthly;
  33. }
  34. echo "Для погашения ссуды при процентной ставке $interest процентов
  35. понадобится $duration месяцев.<hr>";
  36. }
  37. ?>
  38. <form method="POST" action="loan.php">
  39. <input type="hidden" name="posted" value="true">
  40. <br>
  41. Выберите необходимую сумму ссуды<br><br>
  42. <input name="loan" type="radio" value="1000">1000 долларов под 5,0% в месяц
  43. <br>
  44. <input name="loan" type="radio" value="5000">5000 долларов под 6,5% в месяц
  45. <br>
  46. <input name="loan" type="radio" value="10000">10000 долларов под 8,0% в месяц
  47. <br>
  48. <br>
  49. Введите сумму ежемесячного платежа
  50. <input name="month" type="text" size="5">
  51. <br>
  52. <br>
  53. <input type="submit" value="Рассчитать">
  54. </form>
  55. </body>
  56. </html>
  57.  
File Description
  • ghfghgh
  • PHP Code
  • 15 Apr-2022
  • 1.52 Kb
You can Share it: