Advertisement
rinaldohack

Relasi Matematika Diskrit

May 1st, 2016
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.49 KB | None | 0 0
  1. <html>
  2. <head>
  3.     <title>Matematika Diskrit - Relasi </title>
  4. </head>
  5. <body>
  6.  
  7.  
  8. <h1>Matematika Diskrit - Relasi </h1>
  9.  
  10.  
  11. <?php
  12. if (isset($_POST['validator']))
  13. {
  14.     echo("Submit button pressed!<br><br>");
  15.     $jumlah_anggota_a=$_POST['anggota-a'];
  16.     $jumlah_anggota_b=$_POST['anggota-b'];
  17.    
  18.    
  19.        
  20.     echo 'Banyak anggota himpunan A : '.$jumlah_anggota_a.'<br>';
  21.     echo 'Anggota Himpunan A : ';
  22.    
  23.     for ($loop=1;$loop<=$jumlah_anggota_a;$loop++)
  24.     {
  25.         echo $_POST['a'.$loop].' ';
  26.     }
  27.     echo '<br><br>';
  28.     echo 'Banyak anggota himpunan B : '.$jumlah_anggota_b.'<br>';
  29.     echo 'Anggota Himpunan B : ';
  30.    
  31.     for ($loop=1;$loop<=$jumlah_anggota_b;$loop++)
  32.     {
  33.         echo $_POST['b'.$loop].' ';
  34.     }
  35.    
  36.    
  37.     echo '<br><br><br>';
  38.     echo 'Irisan : ';
  39.     for ($loop=1;$loop<=$jumlah_anggota_a;$loop++)
  40.     {
  41.         for ($loop2=1;$loop2<=$jumlah_anggota_b;$loop2++)
  42.         {
  43.             if ($_POST['a'.$loop]==$_POST['b'.$loop2]) 
  44.             {
  45.                 echo ($_POST['a'.$loop]).' ';
  46.             }
  47.         }      
  48.     }  
  49.     echo '<br>';
  50.  
  51. }
  52.    
  53. ?>
  54.  
  55.  
  56. <p>Input anggota</p>
  57. <form method='post' action='relasi.php'>
  58. <table>
  59. <tr>
  60. <td>
  61.  
  62. Elemen A<br>
  63. <input required type='text' placeholder='1' name='a1'><br>
  64. <input required type='text' placeholder='2' name='a2'><br>
  65. <input type='text' placeholder='3' name='a3'><br>
  66. <input type='text' placeholder='4' name='a4'><br>
  67. <input type='text' placeholder='5' name='a5'><br>
  68. <input type='text' placeholder='6' name='a6'><br>
  69. <input type='text' placeholder='7' name='a7'><br>
  70. <input type='text' placeholder='8' name='a8'><br>
  71. <input type='text' placeholder='9' name='a9'><br>
  72. <input type='text' placeholder='10' name='a10'><br>
  73. </td>
  74. <td>
  75. Elemen B<br>
  76. <input required type='text' placeholder='1' name='b1'><br>
  77. <input required type='text' placeholder='2' name='b2'><br>
  78. <input type='text' placeholder='3' name='b3'><br>
  79. <input type='text' placeholder='4' name='b4'><br>
  80. <input type='text' placeholder='5' name='b5'><br>
  81. <input type='text' placeholder='6' name='b6'><br>
  82. <input type='text' placeholder='7' name='b7'><br>
  83. <input type='text' placeholder='8' name='b8'><br>
  84. <input type='text' placeholder='9' name='b9'><br>
  85. <input type='text' placeholder='10' name='b10'><br>
  86. </td>
  87. </tr>
  88. </table>
  89. <br>
  90. <br>
  91. Banyak anggota A : <input required type='text' placeholder='10' name='anggota-a'><br>
  92. Banyak anggota B : <input required type='text' placeholder='10' name='anggota-b'><br>
  93. <input type='hidden' name='validator' value='true'>
  94. <button name='submit' placeholder='Submit' value='Submit'>Submit</button>
  95. </form>
  96.  
  97.  
  98.  
  99. </body>
  100. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement