Advertisement
angryatti

Clown - Negative - Positive Numbers

Aug 11th, 2022
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.80 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="hu">
  3. <head>
  4.     <meta charset="UTF-8">
  5.     <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6.     <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7.     <title>Document</title>
  8. </head>
  9. <body>
  10. <?php
  11. @$num=0;
  12.  
  13.  if(isset($_POST['gomb'])) {
  14.     writeout();
  15.  
  16. @$num=$_POST['szam'];
  17.    
  18. }
  19.  
  20. function writeout(){
  21. $num = $_POST['szam'];
  22. $pre="";
  23.  
  24. if ($num!=0)
  25. {
  26.  
  27. $pre =  ($num>=0) ? "pozitív" :  "negativ";
  28.  
  29. }
  30. else
  31. {$pre ="semleges";}
  32.  
  33.  
  34.  
  35.  
  36.  print_r($pre);
  37.  
  38. }
  39.  
  40. ?>
  41.  
  42. <form name="form" method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>">
  43. <input type="number" value="<?php print @$num; ?>" name="szam" id="szam">
  44. <button type="submit" name="gomb" id="gomb" >Kattints ide</button>
  45.  
  46.  
  47. </form>
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56. </body>
  57. </html>
  58.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement