【发布时间】:2017-09-30 11:36:38
【问题描述】:
我有 2 个文件:grampermol.php 和 kemi.html。在 kemi.html 中,我调用了一个 javascript 函数,该函数在按下按钮时运行 grampermol.php 文件。我遇到的问题是,我无法从位于 html 文件中的 php 输入字段中获取值。
kemi.html 按钮功能:
<input type="text" name="molar_mass" id="molar_mass" placeholder="Fx CH4" size="20">
<br>
<button style="margin-bottom: 1em; margin-top: 1em;" name="BUTTON_1" onclick="gramsPerMole()" type="submit" class="btn btn-success">Beregn</input>
grampermol.php:
<?php
function calculate() {
$formula = $_POST['molar_mass'];
}
calculate();
?>
我收到一条错误消息,提示摩尔质量不存在。
【问题讨论】:
标签: javascript php html input interaction