Php JavaScript表单弹出


Php JavaScript Form Popup

我试图让我的脚本能够使用弹出窗口输入其中一个文本框,这是有效的,但当我去计算值它不计算它们。我认为它与表单id有关,但我不知道具体要改变什么。

 <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"
应该

<form id="frm1" method="post"

缺少一个"

<td align="center"" colspan="1">Intermediate Variables</td>
应该

<td align="center" colspan="1">Intermediate Variables</td>

有额外的" after align

希望能有所帮助