Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <title>Matematika Diskrit - Relasi </title>
- </head>
- <body>
- <h1>Matematika Diskrit - Relasi </h1>
- <?php
- if (isset($_POST['validator']))
- {
- echo("Submit button pressed!<br><br>");
- $jumlah_anggota_a=$_POST['anggota-a'];
- $jumlah_anggota_b=$_POST['anggota-b'];
- echo 'Banyak anggota himpunan A : '.$jumlah_anggota_a.'<br>';
- echo 'Anggota Himpunan A : ';
- for ($loop=1;$loop<=$jumlah_anggota_a;$loop++)
- {
- echo $_POST['a'.$loop].' ';
- }
- echo '<br><br>';
- echo 'Banyak anggota himpunan B : '.$jumlah_anggota_b.'<br>';
- echo 'Anggota Himpunan B : ';
- for ($loop=1;$loop<=$jumlah_anggota_b;$loop++)
- {
- echo $_POST['b'.$loop].' ';
- }
- echo '<br><br><br>';
- echo 'Irisan : ';
- for ($loop=1;$loop<=$jumlah_anggota_a;$loop++)
- {
- for ($loop2=1;$loop2<=$jumlah_anggota_b;$loop2++)
- {
- if ($_POST['a'.$loop]==$_POST['b'.$loop2])
- {
- echo ($_POST['a'.$loop]).' ';
- }
- }
- }
- echo '<br>';
- }
- ?>
- <p>Input anggota</p>
- <form method='post' action='relasi.php'>
- <table>
- <tr>
- <td>
- Elemen A<br>
- <input required type='text' placeholder='1' name='a1'><br>
- <input required type='text' placeholder='2' name='a2'><br>
- <input type='text' placeholder='3' name='a3'><br>
- <input type='text' placeholder='4' name='a4'><br>
- <input type='text' placeholder='5' name='a5'><br>
- <input type='text' placeholder='6' name='a6'><br>
- <input type='text' placeholder='7' name='a7'><br>
- <input type='text' placeholder='8' name='a8'><br>
- <input type='text' placeholder='9' name='a9'><br>
- <input type='text' placeholder='10' name='a10'><br>
- </td>
- <td>
- Elemen B<br>
- <input required type='text' placeholder='1' name='b1'><br>
- <input required type='text' placeholder='2' name='b2'><br>
- <input type='text' placeholder='3' name='b3'><br>
- <input type='text' placeholder='4' name='b4'><br>
- <input type='text' placeholder='5' name='b5'><br>
- <input type='text' placeholder='6' name='b6'><br>
- <input type='text' placeholder='7' name='b7'><br>
- <input type='text' placeholder='8' name='b8'><br>
- <input type='text' placeholder='9' name='b9'><br>
- <input type='text' placeholder='10' name='b10'><br>
- </td>
- </tr>
- </table>
- <br>
- <br>
- Banyak anggota A : <input required type='text' placeholder='10' name='anggota-a'><br>
- Banyak anggota B : <input required type='text' placeholder='10' name='anggota-b'><br>
- <input type='hidden' name='validator' value='true'>
- <button name='submit' placeholder='Submit' value='Submit'>Submit</button>
- </form>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement