我的脚本重新启动并且不输出。这是代码:
<?php if (isset($_POST['submit3']) || isset($_POST['submit2'])) : ?>
<?php else : ?>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<br>Nacin rada 1
<br>Nacin rada 2
<input type="submit" name="submit2" value="Nacin rada 1">
<input type="submit" name="submit3" value="Nacin rada 2">
</form>
<?php endif ?>
<?php if (isset($_POST['submit2'])) : ?>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
Zeljena dubina: <input size="5" type="text" name="dubina"><br>
Ulazni kut glave: <input size="5" type="text" name="uk"><br>
Maximalan kut pomaka glave: <input value="2" size="5" type="text" name="kpg"><br>
<input type="submit" name="submit" value="Unesi Vrijednosti">
</form>
<?php
if (isset($_POST['submit'])) { //preuzimanje formova
$_POST['submit2'] = true;
$kpg = 0;
$dubina = (int)$_POST['dubina'];
//some math stuff and working output
}
?>
<?php elseif (isset($_POST['submit3'])) : ?>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
Zeljena dubina: <input size="5" type="text" name="dubina"><br>
Zeljena udaljenost: <input size="5" type="text" name="duljina"><br>
Maximalan kut pomaka glave: <input value="2" size="5" type="text" name="kpg"><br>
<input type="submit" name="submit5" value="Unesi Vrijednosti">
</form>
<?php
if (isset($_POST['submit5'])) { //preuzimanje formova
$_POST['submit3'] = true;
$kpg = 0;
$dubina = (int)$_POST['dubina'];
$duljina = (int)$_POST['duljina'];
// some math stuff and working output
}
?>
<?php endif ?>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<input type="submit" name="submit4" value="Kreni ponovno">
</form>
所以基本上我想做的是首先显示 2 个按钮,然后单击其中一个按钮进入该模式,在该模式下我们必须输入一些参数,然后单击另一个按钮输入数据。然后脚本应该编写代码并输出最终结果......当我不希望这个具有 2 种模式的解决方案都能很好地工作时,试图打开所有错误和信息,但什么也没有。我认为问题在于 if 语句连接了 w 按钮但找不到它