簡體   English   中英

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>

對齊后有多余的

希望這可以幫助

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM