任何PHP专家:我是一个初学者。我有这样的参比电极转换器:下拉菜单很奇怪
<!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>
奇怪的是,当我点击“转换”的下拉菜单回去什么“选择”的HTML变量了。我能做些什么来解决这个问题?
感谢 -Lorelo
你不需要了解Referanse电极是什么, – Lorelo
你拼错在第二种方式中“引用”现在,只是说... –
哦,谢谢......我现在感觉不好 – Lorelo