すべての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
あなたは参照電極が何であるかを理解する必要はありません通貨と考えてください – Lorelo
2番目の方法で間違いを犯しました。ただ言って... –
ああありがとう......私は今は気分がいい – Lorelo