<html><head><title>Lottó</title></head><body><center><form name="lotto" action="index.php" method="POST"><h1><u>Lottó</u> <input type="submit" name="ujra" value="Újra" /></h1></form> <?php$tipp=array(0,1,2,3,4,5);function kepre($tomb){$tipp=array(0,1,2,3,4,5); print "<table border=\"2\" bordercolor=\"black\" cellpadding=\"5\" cellspacing=\"0\" >\n"; for ($i=1; $i<91; $i++) { print "<font size=\"6\">"; if($tipp[1]==$i || $tipp[2]==$i || $tipp[3]==$i || $tipp[4]==$i || $tipp[5]==$i) print "<td bgcolor=\"#47FF00\">"; else print "<td bgcolor=\"#eeeeee\">"; print $i; print "</font>"; if($i%15==0) { print "<tr>\n"; } } print "</table>\n"; return true;}$tomb = array();//tömbfeltöltésfor ($i=1; $i<=90; $i++){ $tomb[$i] = 0;}//lottóhúzásfor ($i=1; $i<=5; $i++){ do{ $v = rand(1,90); }while ( $tomb[$v] == 1 ); $tomb[$v] = 1; $t[$i]=$v;}print "A nyerőszámok a következőek: <br />";for ($i=1; $i<6; $i++){ echo $i.". kihúzott szám: ".$t[$i]."<br />";}print "Az általam tippelt nyerőszámok a következőek: <br />";for ($i=1; $i<6; $i++){ echo $i.". tippelt szám: ".$tipp[$i]."<br />";}kepre($tomb);?></center></body></html>
Very quickly since I am at work: 1. Run your script here : https://sandbox.onlinephpfunctions.com/2. Run output here : https://codebeautify.org/htmlviewerIn link 2, basic HTML errors are highlighted. This way you can quickly check if the error is format error vs logic error in the php. Let me know
function kepre($tomb){$tipp=array(0,1,2,3,4,5);$table = "";//print_r($tomb); use this to print $table.="<table border=\"2\" bordercolor=\"black\" cellpadding=\"5\" cellspacing=\"0\" >\n"; for ($i=1; $i<91; $i++) { $table.="<font size=\"6\">"; if(in_array($i, $tipp)){ //echo "i be: $i"; if($tomb[$i] == 1){ $table.="<td bgcolor=\"#FF0000\">"; } else{ $table.="<td bgcolor=\"#47FF00\">"; } } else $table.="<td bgcolor=\"#eeeeee\">"; $table.=$i; $table.="</td></font>"; // never closed your td tag if($i%15==0) { $table.="<tr>\n"; } } $table.="</table>\n"; echo $table; return true;}
Array ( [1] => 0 [2] => 0 [3] => 0 [4] => 0 [5] => 0 [6] => 0 [7] => 0 [8] => 0 [9] => 0 [10] => 0 [11] => 0 [12] => 0 [13] => 0 [14] => 0 [15] => 0 [16] => 0 [17] => 0 [18] => 0 [19] => 0 [20] => 0 [21] => 0 [22] => 0 [23] => 0 [24] => 0 [25] => 0 [26] => 1 [27] => 0 [28] => 0 [29] => 0 [30] => 0 [31] => 0 [32] => 1 [33] => 0 [34] => 0 [35] => 0 [36] => 1 [37] => 0 [38] => 0 [39] => 0 [40] => 0 [41] => 0 [42] => 0 [43] => 0 [44] => 0 [45] => 0 [46] => 0 [47] => 0 [48] => 0 [49] => 0 [50] => 0 [51] => 0 [52] => 0 [53] => 0 [54] => 0 [55] => 0 [56] => 0 [57] => 0 [58] => 0 [59] => 0 [60] => 0 [61] => 0 [62] => 0 [63] => 0 [64] => 0 [65] => 0 [66] => 0 [67] => 0 [68] => 0 [69] => 0 [70] => 0 [71] => 0 [72] => 0 [73] => 0 [74] => 0 [75] => 1 [76] => 0 [77] => 0 [78] => 0 [79] => 0 [80] => 1 [81] => 0 [82] => 0 [83] => 0 [84] => 0 [85] => 0 [86] => 0 [87] => 0 [88] => 0 [89] => 0 [90] => 0 )
<p>scope. For example:</p><?php$a = 1; /* global scope */ function test(){ echo $a; /* reference to local scope variable */ } test();?><p>This script will not produce any output because the echo statement refers to a local version of the $a variable, and it has not been assigned a value within this scope. You may notice that this is a little bit different from the C language in that global variables in C are automatically available to functions unless specifically overridden by a local definition. This can cause some problems in that people may inadvertently change a global variable. In PHP global variables must be declared global inside a function if they are going to be used in that function. </p><p>example 2</p><?php$a = 1; /* global scope */ function testb($parametera){ echo $parametera; /* output 1 */ } testb($a);?><p>example 3</p><?php$a = 1; /* global scope */ function testc($a = 2){ echo $a; /* output 2 */ } testc();?><p>example 4</p><?php$a = 1; /* global scope */ function testd($a){ echo $a; /* output 1 */ echo '<p></p> '; $a = $a + 5; echo $a;/* output 6 */} testd($a);echo '<p></p> ';echo $a; /* output 1 */?><p>example 5 return</p><?php$a = 1; /* global scope */ function teste($a){ $a = $a + 5; return $a;/* return 6 */} echo $a;/* output 1 */$a = teste($a); /* returned value 6*/echo '<p></p> ';echo $a; /* output 6 */?>
i extended the examples here...
Glad you got the help needed