Couple Generator v1.0

Ini kode program yang iseng saya buat untuk kebutuhan main di klub badminton saya, 200,000 BC Cisitu. Simpel aja cuma pakai array_shuffle. Demonya bisa lihat di sini.

Source codenya :

<!-- code by rizky -->
<html>
<head>
	<title>Couple Generator</title>
</head>
<body>
<h1>Couple Generator</h1>
Input Member <b>
<form action="." method="post">
	01 - <input type="text" name="a" value="Neo"><br>
	02 - <input type="text" name="b" value="Riz"><br>
	03 - <input type="text" name="c" value="Dha"><br>
	04 - <input type="text" name="d" value="Kam"><br>
	05 - <input type="text" name="e" value="Dhi"><br>
	06 - <input type="text" name="f" value="Del"><br>
	07 - <input type="text" name="g" value="Pra"><br>
	08 - <input type="text" name="h" value="Har"><br>
	09 - <input type="text" name="i" value="Gin"><br>
	10 - <input type="text" name="j" value="Ter"><br>

	<br><input type="submit" value="Random">
</form>

<?php
if($_POST){
$member = array();
array_push($member,$_POST['a']);
array_push($member,$_POST['b']);
array_push($member,$_POST['c']);
array_push($member,$_POST['d']);
array_push($member,$_POST['e']);
array_push($member,$_POST['f']);
array_push($member,$_POST['g']);
array_push($member,$_POST['h']);
array_push($member,$_POST['i']);
array_push($member,$_POST['j']);

shuffle($member);

$c1 = array_pop($member).'-'.array_pop($member);
$c2 = array_pop($member).'-'.array_pop($member);
$c3 = array_pop($member).'-'.array_pop($member);
$c4 = array_pop($member).'-'.array_pop($member);
$c5 = array_pop($member).'-'.array_pop($member);

echo '<br>RESULT';
echo '<br>------';

echo '<br>Couple 1 : '.$c1;
echo '<br>Couple 2 : '.$c2;
echo '<br>Couple 3 : '.$c3;
echo '<br>Couple 4 : '.$c4;
echo '<br>Couple 5 : '.$c5;

echo '<br><br>MATCH'.
	 '<br>--------------';
echo "<br>match 01 : $c1 vs $c2";
echo "<br>match 02 : $c3 vs $c4";
echo "<br>match 03 : $c2 vs $c5";
echo "<br>match 04 : $c1 vs $c3";
echo "<br>match 05 : $c4 vs $c5";
echo "<br>match 06 : $c2 vs $c3";
echo "<br>match 07 : $c1 vs $c4";
echo "<br>match 08 : $c3 vs $c5";
echo "<br>match 09 : $c2 vs $c4";
echo "<br>match 10 : $c1 vs $c5";
}
?>
</body>
</html>

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s