Advertisement
Guest User

Untitled

a guest
May 26th, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.71 KB | None | 0 0
  1. <html> 
  2. <title>PHP Count Script!</title>
  3. <body>     
  4. <!-- Form -->
  5. <form action="count.php" method="POST">    
  6. Count from:<input type="text" name="text1"><br>        
  7. Count to:<input type="text" name="text2"><br>          
  8. <input type="submit" name="submit" value="Count!">
  9. </form>
  10. Notice: The larger the number between, the longer the load time.<br>
  11. </body>
  12. </html>
  13. <?php
  14. if ($_POST['submit'])
  15. {
  16. $text1 = $_POST['text1'];
  17. $text2 = $_POST['text2'];
  18. if ($text1&&$text2)
  19. {
  20. if ($text1 > $text2)
  21. {
  22. die("The Count from number cannot be greater than the Count to number!");
  23. }
  24. $text1 = $text1 - 1;
  25. while($text2 > $text1) {
  26. $text1 = ($text1 + 1);
  27. echo $text1.'<br>';
  28. }
  29. }
  30. else
  31. die("Please fill in all boxes!");
  32. }
  33. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement