[insert_php]
$debug = 0;
$URL = “https://www.erbijdoetinchem.nl/TalentType/”;
$Talententype = array
(
array(“Het artistieke type”,”rood”,0,”#artistiek”),
array(“Het nauwkeurige type”,”blauw”,0,”#nauwkeurig”,),
array(“Het ondernemende type”,”oranje”,0,”#ondernemend”),
array(“Het praktische type”,”paars”,0,”#praktisch”),
array(“Het intellectuele type”,”groen”,0,”#intellectueel”),
array(“Het sociale type”,”geel”,0,”#sociaal”)
);
$arrlength = count($Talententype);
if ($_SERVER[“REQUEST_METHOD”] == “POST”)
{
$counter=0;
if ($_POST[‘talent’] == “” )
{
echo “Fout: Er is geen enkele keuze gemaakt
“;
}
else
{
foreach ($_POST[“talent”] as $value)
{
if ($value)
{
for($x = 0; $x < $arrlength; $x++)
{
if ($value == $Talententype[$x][1])
{
$Talententype[$x][2]++;
}
}
}
$counter++;
}
/* sorteer array */
$x = 2;
$len = $arrlength;
do
{
$swapped = false;
for( $i = 0; $i<$len; $i++ )
{
if ($debug == 1) echo $i.": ". $Talententype[$i][$x]." - ".$Talententype[$i + 1][$x]."
“;
if ( $Talententype[$i][$x] < $Talententype[$i + 1][$x] )
{
$a=$Talententype[$i][0];
$b=$Talententype[$i][1];
$c=$Talententype[$i][2];
$d=$Talententype[$i][3];
$Talententype[$i][0] = $Talententype[$i + 1][0];
$Talententype[$i][1] = $Talententype[$i + 1][1];
$Talententype[$i][2] = $Talententype[$i + 1][2];
$Talententype[$i][3] = $Talententype[$i + 1][3];
$Talententype[$i + 1][0] = $a;
$Talententype[$i + 1][1] = $b;
$Talententype[$i + 1][2] = $c;
$Talententype[$i + 1][3] = $d;
$swapped = true;
}
}
if ($debug == 1) echo "
“;
}
while( $swapped );
echo “Dit type ben jij (in volgorde van talent):\n”;
for($x = 0; $x < 3; $x++)
{
if ($debug == 1) echo $Talententype[$x][0].": ".$Talententype[$x][2]."
“;
echo ““.$Talententype[$x][0].”“.”
“;
}
}
}
[/insert_php]