-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathresultat.php
55 lines (42 loc) · 1.11 KB
/
resultat.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
print "<center><form method = 'post' action = 'chaima.php' >";
if(isset($_POST['choisis'])){
echo"votre selection";
echo "<table border = '1' , cellpadding='6', textalign='center'><tr>";
foreach ($_POST['choisis'] as $value) {
echo " <td>".$value."</td>";
}
}
echo "</tr></table> ";
echo "resultat du tirage <table border = '1' , cellpadding='6', textalign='center'><tr>";
$tab=realise_tirage();
foreach ($tab as $val) {
echo "<td>".$val."</td>";
}
echo "</tr></table> ";
//-------------------
$a=0;
foreach ($tab as $val) {
foreach ($_POST['choisis'] as $value) {
if ($val==$value) {
$a++;
}
}}
echo "vous avez eu " .$a. " bon numero";
print "<br><br><button type = 'submit' >retour a la grille</button><br></forme></center>";
function realise_tirage() {
$tab = array();
$busy = false; //numéro unique
for ($i=0; $i<6; $i++) {
do {
$nb = rand(1,49);
foreach ($tab as $val) {
if ($busy = ($val == $nb))
break;
}
} while ($busy);
$tab[] = $nb;
}
return $tab;
}
?>