简体   繁体   English

PHP JavaScript表单弹出窗口

[英]Php JavaScript Form Popup

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. 我认为这与表单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"

should be 应该

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

missing one " 缺少一个

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 希望这可以帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM