I am trying to have my script be able to use a popup to enter one of the textboxes, which works, but when I go to calculate the values it does not calculate them. I think it has something to do with the form id, but I do not know specifically what to change.
<script type="text/javascript">
function resetPassword() {
var email = prompt("Search Value", "");
if (email != null) {
document.getElementById("email1").value = email;
document.getElementById("frm1").submit();
}
}
</script>
<?php
$emitter = 0;
$rings = 0;
$wave = 0;
$gls = 0;
$tiles = 0;
$fov = 0;
if(isset($_POST['calculate']))
{
$rings = $_POST['rings'];
$wave = $_POST['wave'];
$emitter = $_POST['emitter'];
$gls = round(22 * sin($wave / ($emitter / tan ($emitter / 4))), 2);
$tiles = round(5 * $rings, 2);
$fov = round((90 / M_PI) * $gls * (sqrt(9) / 4) * $rings, 2);
}
?>
<html>
<head>
<title>Field of View Calculator</title>
</head>
<body>
<form id="frm1 method="post" action="Test_Calculator.php" enctype="multipart/form-data">
<table width="500" align="center" border="10">
<tr>
<td align="center" bgcolor="khaki" colspan="6"><h1>Field of View</h1></td>
</tr>
<tr>
<td align="center" colspan="1">Input</td>
<td align="center"" colspan="1">Intermediate Variables</td>
<td align="center" colspan="1">Output</td>
</tr>
<tr>
<td>Number of Rings <input type="text" name="rings" value = "<?php echo $rings; ?>" size="30"></td>
<td>Grating Lobe Separation <input type="text" name="gls" value = "<?php echo $gls; ?>" size="30"></td>
<td>Field of View <input type="text" name="fov" value = "<?php echo $fov; ?>" size="30"></td>
</tr>
<tr>
<td>Wavelength <input type="text" name="wave" value = "<?php echo $wave; ?>" size="30"></td>
<td>Number of Tiles <input type="text" name="tiles" value = "<?php echo $tiles; ?>" size="30"></td>
</tr>
<tr>
<td>Emitter Space<input id="email1" type="text" name="emitter" value = "<?php echo $emitter; ?>" size="30">
<input id="email" onclick="resetPassword()" type="text" name="email" placeholder="Search Value" />
</tr>
<tr>
<td align="center" colspan="6">Static Values</td>
</tr>
<tr>
<td align="center" colspan="6"><textarea name="content" cols="80" rows="15"></textarea></td>
</tr>
<tr>
<td align="center" colspan="6"><input type="submit" name="calculate" value="Calculate"></td>
</tr>
</form>
</body>
</html>
<form id="frm1 method="post"
should be
<form id="frm1" method="post"
and
<td align="center"" colspan="1">Intermediate Variables</td>
should be
<td align="center" colspan="1">Intermediate Variables</td>
has extra " after align
Hope this helps
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.