Mein Code sieht jetzt so aus und funktioniert immernoch nicht...Hilfe!!:
<form action="" method="post" name="color">
<input type="submit" value="Nächster Versuch"><br>
<label for="p1">Position 1:</label>
<select name="p1" size="1" id="p1">
<option value="yellow">Gelb</option><option value="red">Rot</option><option value="green">Grün</option><option value="blue">Blau</option>
</select><br>
<label for="p2">Position 2:</label>
<select name="p2" size="1" id="p2">
<option value="yellow">Gelb</option><option value="red">Rot</option><option value="green">Grün</option><option value="blue">Blau</option>
</select><br>
<label for="p3">Position 3:</label>
<select name="p3" size="1" id="p3">
<option value="yellow">Gelb</option><option value="red">Rot</option><option value="green">Grün</option><option value="blue">Blau</option>
</select><br>
</form>
<?php
$colo1 = mt_rand(1,4);
$colo2 = mt_rand(1,4);
$colo3 = mt_rand(1,4);
if($colo1 == 1){
$color1 = "yellow"; }
elseif($colo1 == 2){
$color1 = "red"; }
elseif($colo1 == 3){
$color1 = "green"; }
else{ $color1 = "blue"; }
if($colo2 == 1){
$color2 = "yellow"; }
elseif($colo2 == 2){
$color2 = "red"; }
elseif($colo2 == 3){
$color2 = "green"; }
else{ $color2 = "blue"; }
if($colo3 == 1){
$color3 = "yellow"; }
elseif($colo3 == 2){
$color3 = "red"; }
elseif($colo3 == 3){
$color3 = "green"; }
else{ $color3 = "blue"; }
$format = "Es sind %d Farben (auf %d Positionnen) richtig.";
if(isset($_POST["color"])){
if($_POST["p1"] == $color1 || $_POST["p1"] == $color2 || $_POST["p1"] == $color3){
$d++;
if($_POST["p2"] == $color1 || $_POST["p2"] == $color2 || $_POST["p2"] == $color3){
$d++;
if($_POST["p3"] == $color1 || $_POST["p3"] == $color2 || $_POST["p3"] == $color3){
$d++;
}else{}}else{}}else{}
if($_POST["p1"] == $color1){
$b++;
if($_POST["p2"] == $color2){
$b++;
if($_POST["p3"] == $color3){
$b++;
}else{}}else{}}else{}
}else{}
if( $d == 3 && $b == 3){
echo "Herzlichen Glückwunsch, Sie haben gewonnen!"; }
else{ printf($format,$d,$b); }