gold can not be on stripe 2
';
break;
case silver:
$errors['Stripe1'] = 'The color silver can not be on stripe 2
';
break;
}
// Stripe 2
switch (strtolower($_POST['Stripe2'])) {
case black:
$_POST['Stripe2'] = '0';
break;
case brown:
$_POST['Stripe2'] = '1';
break;
case red:
$_POST['Stripe2'] = '2';
break;
case orange:
$_POST['Stripe2'] = '3';
break;
case yellow:
$_POST['Stripe2'] = '4';
break;
case green:
$_POST['Stripe2'] = '5';
break;
case blue:
$_POST['Stripe2'] = '6';
break;
case violet:
$_POST['Stripe2'] = '7';
break;
case grey:
$_POST['Stripe2'] = '8';
break;
case white:
$_POST['Stripe2'] = '9';
break;
}
// Errors
switch (strtolower($_POST['Stripe2'])) {
case gold:
$errors['Stripe2'] = 'The color gold can not be on stripe 2
';
break;
case silver:
$errors['Stripe2'] = 'The color silver can not be on stripe 2
';
break;
}
// Stripe 3
switch (strtolower($_POST['Stripe3'])) {
case black:
$_POST['Stripe3'] = '1';
break;
case brown:
$_POST['Stripe3'] = '10';
break;
case red:
$_POST['Stripe3'] = '100';
break;
case orange:
$_POST['Stripe3'] = '1000';
break;
case yellow:
$_POST['Stripe3'] = '10000';
break;
case green:
$_POST['Stripe3'] = '100000';
break;
case blue:
$_POST['Stripe3'] = '1000000';
break;
}
// Errors
switch (strtolower($_POST['Stripe3'])) {
case violet:
$errors['Stripe3'] = 'The color violet can not be on stripe 3
';
break;
case grey:
$errors['Stripe3'] = 'The color grey can not be on stripe 3
';
break;
case white:
$errors['Stripe3'] = 'The color white can not be on stripe 3
';
break;
}
// Stripe 4
switch (strtolower($_POST['Stripe4'])) {
case brown:
$_POST['Stripe4'] = 1;
break;
case red:
$_POST['Stripe4'] = 2;
break;
case gold:
$_POST['Stripe4'] = 5;
break;
case silver:
$_POST['Stripe4'] = 10;
break;
}
// Errors
switch (strtolower($_POST['Stripe4'])) {
case orange:
$errors['Stripe4'] = 'The color orange can not be on stripe 4
';
break;
case yellow:
$errors['Stripe4'] = 'The color yellow can not be on stripe 4
';
break;
case green:
$errors['Stripe4'] = 'The color green can not be on stripe 4
';
break;
case blue:
$errors['Stripe4'] = 'The color blue can not be on stripe 4
';
break;
case violet:
$errors['Stripe4'] = 'The color violet can not be on stripe 4
';
break;
case grey:
$errors['Stripe4'] = 'The color grey can not be on stripe 4
';
break;
case white:
$errors['Stripe4'] = 'The color white can not be on stripe 4
';
break;
case black:
$errors['Stripe4'] = 'The color black can not be on stripe 4
';
break;
}
$stripe['1'] = $_POST['Stripe1'];
$stripe['2'] = $_POST['Stripe2'];
$stripe['3'] = $_POST['Stripe3'];
$stripe['4'] = $_POST['Stripe4'];
if(empty($errors)){
$x = $stripe['1'].$stripe['2'];
$resistance = $x*$stripe['3'] . "Ω with " . $stripe['4'] . "% in tolerance";
}else{
echo '
Hello World