Alle PHP-Experten: Ich bin ein Anfänger. Ich habe diese Referenzelektrode Converter:Dropdown-Menü ist seltsam
<!DOCTYPE html>
<html>
<head>
<title>Referance Electrode Converter</title>
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<h1>Referance Electrode Converter</h1>
<h6>After Pressing Convert The Dropdown Goes Back to It's Defaults</h6>
<form action="index.php" method="get">
<input type="text" name="input" placeholder="Enter Amount"></input>
<select name="dropdown">
<option value="SHE" selected><sub>SHE</sub></option>
<option value="SCE"><sub>SCE</sub></option>
<option value="AG"><sub>Ag/AgCl</sub></option>
<option value="MSE">MSE</option>
<option value="CSE">CSE</option>
</select>
<br />
<?php
$cc_input = $_GET['input'];
$cc_dropdown = $_GET['dropdown'];
$cc_odropdown = $_GET['odropdown'];
if(isset($_GET['sbmt']))
{
if($cc_dropdown == 'SHE') {
if($cc_odropdown == 'SHE') {
$output = $cc_input * 1 . "V";
echo "<input type='text' value='$output' disabled/>";
} elseif($cc_odropdown == 'SCE') {
$output = $cc_input + 0.2415 . "V";
echo "<input type='text' value='$output' disabled/>";
} elseif($cc_odropdown == 'AG') {
$output = $cc_input + 0.222 . "V";
echo "<input type='text' value='$output' disabled/>";
} elseif($cc_odropdown == 'MSE') {
$output = $cc_input - 0.615 . "V";
echo "<input type='text' value='$output' disabled/>";
} elseif($cc_odropdown == 'CSE') {
$output = $cc_input - 0.318 . "V";
echo "<input type='text' value='$output' disabled/>";
}
}
elseif($cc_dropdown == 'SCE') {
if($cc_odropdown == 'SHE') {
$output = $cc_input - 0.2415 . "V";
echo "<input type='text' value='$output' disabled/>";
} elseif($cc_odropdown == 'SCE') {
$output = $cc_input * 1 . "V";
echo "<input type='text' value='$output' disabled/>";
} elseif($cc_odropdown == 'AG') {
$output = $cc_input + 0.0195 . "V";
echo "<input type='text' value='$output' disabled/>";
} elseif($cc_odropdown == 'MSE') {
$output = $cc_input - 0.3735 . "V";
echo "<input type='text' value='$output' disabled/>";
} elseif($cc_odropdown == 'CSE') {
$output = $cc_input - 0.765 . "V";
echo "<input type='text' value='$output' disabled/>";
}
}
elseif($cc_dropdown == 'AG') {
if($cc_odropdown == 'SHE') {
$output = $cc_input - 0.222 . "V";
echo "<input type='text' value='$output' disabled/>";
} elseif($cc_odropdown == 'SCE') {
$output = $cc_input - 0.0195;
echo "<input type='text' value='$output' disabled/>";
} elseif($cc_odropdown == 'AG') {
$output = $cc_input * 1 . "V";
echo "<input type='text' value='$output' disabled/>";
} elseif($cc_odropdown == 'MSE') {
$output = $cc_input - 0.393 . "V";
echo "<input type='text' value='$output' disabled/>";
} elseif($cc_odropdown == 'CSE') {
$output = $cc_input - 0.096 . "V";
echo "<input type='text' value='$output' disabled/>";
}
}
elseif($cc_dropdown == 'MSE') {
if($cc_odropdown == 'SHE') {
$output = $cc_input + 0.615 . "V";
echo "<input type='text' value='$output' disabled/>";
} elseif($cc_odropdown == 'SCE') {
$output = $cc_input + 0.3735 . "V";
echo "<input type='text' value='$output' disabled/>";
} elseif($cc_odropdown == 'AG') {
$output = $cc_input + 0.393 . "V";
echo "<input type='text' value='$output' disabled/>";
} elseif($cc_odropdown == 'MSE') {
$output = $cc_input * 1 . "V";
echo "<input type='text' value='$output' disabled/>";
} elseif($cc_odropdown == 'CSE') {
$output = $cc_input + 0.297 . "V";
echo "<input type='text' value='$output' disabled/>";
}
}
elseif($cc_dropdown == 'CSE') {
if($cc_odropdown == 'SHE') {
$output = $cc_input + 0.318 . "V";
echo "<input type='text' value='$output' disabled/>";
} elseif($cc_odropdown == 'SCE') {
$output = $cc_input + 0.0765 . "V";
echo "<input type='text' value='$output' disabled/>";
} elseif($cc_odropdown == 'AG') {
$output = $cc_input + 0.096 . "V";
echo "<input type='text' value='$output' disabled/>";
} elseif($cc_odropdown == 'MSE') {
$output = $cc_input - 0.297 . "V";
echo "<input type='text' value='$output' disabled/>";
} elseif($cc_odropdown == 'CSE') {
$output = $cc_input * 1 . "V";
echo "<input type='text' value='$output' disabled/>";
}
}
}
?>
<select name="odropdown">
<option value="SHE"><sub>SHE</sub></option>
<option value="SCE" selected><sub>SCE</sub></option>
<option value="AG"><sub>Ag/AgCl</sub></option>
<option value="MSE">MSE</option>
<option value="CSE">CSE</option>
</select>
<br />
<input type="submit" name="sbmt" value="Convert!"></input>
</form>
</body>
</html>
Das Seltsame ist, dass, wenn ich auf „Konvertieren“, die Drop-Down-Menüs gehen zurück auf das, was die HTML „ausgewählt“ Variable war. Was kann ich tun, um dieses Problem zu beheben?
Dank -Lorelo
Sie müssen nicht verstehen, was Referanse Elektrode ist, denken Sie daran wie Währung – Lorelo
Sie falsch geschrieben "Referenz" in einer zweiten Art jetzt, nur zu sagen ... –
Oh Danke ...... Ich fühle mich jetzt schlecht – Lorelo