springboot怎么把数据传给前端:springboot 如何引入前端 bootstrap?
这种问题网上一搜一大堆,你可以具体找一篇文章试试,遇到问题可以针对相关问题去提问。springboot通过jar包方式引入bootstrap_个人文章 - SegmentFault 思否 这不是查查就
顺晟科技
2022-10-19 14:13:46
14
所以我尝试使用PHP和HTML创建一个燃料计算器表单。在很大程度上,我的表单已经非常充实了,但是,有一件事让我卡住了。
所以我想创建一个从用户那里获得输入的燃料津贴选项。我想向用户提出的问题是,他们是否购买了食品杂货。如果用户输入yes,那么我希望出现一个不同的输入框,询问用户他们在杂货中花费的金额,然后根据该输入计算燃料点。但是,我不知道如何根据他们的回答来得到他们在杂货上花了多少钱的初始问题。
以下是我目前掌握的信息:
<form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>">
How many miles did you drive? <input type="text" name="milesDriven" value="<?php echo $milesDriven;?>">
<span class="error">* <?php echo $milesDrivenErr;?></span>
<br><br>
What is your cars miles per gallon?:
<input type="text" name="milesPerGallon" value="<?php echo $milesPerGallon;?>">
<span class="error">* <?php echo $milesPerGallonErr;?></span>
<br><br>
Type of gas used:
<br><br>
<input type="radio" name="gasType" <?php if (isset($gasType) && $gasType=="87 octane - 1.89$/gal") echo "checked";?> value="1.89">87 octane - 1.89$/global
<br><br>
<input type="radio" name="gasType" <?php if (isset($gasType) && $gasType=="89 octane - 1.99$/gal") echo "checked";?> value="1.99">89 octane - 1.99$/global
<br><br>
<input type="radio" name="gasType" <?php if (isset($gasType) && $gasType=="92 octane - 2.09$/gal") echo "checked";?> value="2.09">92 octane - 2.09$/global
<br><br>
<input type="text" name="groceries"
<?php
if ($groceries = "yes") {
//code here that causes the input field to appear
}else if ($groceries = "no") {
//do nothing and proceed with the calculation
}
?>
<input type="submit" name="submit" value="Submit">
</form>
您可以在PHP块中创建表单输入吗?如果这是个愚蠢的问题,请原谅我。我仍然是一个初学者,试图学习更多关于后端编码的知识。
顺晟科技:
您可以在PHP块中创建表单输入吗?当然可以,您可以像这样简单地做
<form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>">
How many miles did you drive? <input type="text" name="milesDriven" value="<?php echo $milesDriven;?>">
<span class="error">* <?php echo $milesDrivenErr;?></span>
<br><br>
What is your cars miles per gallon?:
<input type="text" name="milesPerGallon" value="<?php echo $milesPerGallon;?>">
<span class="error">* <?php echo $milesPerGallonErr;?></span>
<br><br>
Type of gas used:
<br><br>
<input type="radio" name="gasType" <?php if (isset($gasType) && $gasType=="87 octane - 1.89$/gal") echo "checked";?> value="1.89">87 octane - 1.89$/global
<br><br>
<input type="radio" name="gasType" <?php if (isset($gasType) && $gasType=="89 octane - 1.99$/gal") echo "checked";?> value="1.99">89 octane - 1.99$/global
<br><br>
<input type="radio" name="gasType" <?php if (isset($gasType) && $gasType=="92 octane - 2.09$/gal") echo "checked";?> value="2.09">92 octane - 2.09$/global
<br><br>
<input type="text" name="groceries"
<?php
if ($groceries = "yes") {
//code here that causes the input field to appear
}else if ($groceries = "no") {
//do nothing and proceed with the calculation
}
?>
<input type="submit" name="submit" value="Submit">
</form>
并计算当
时的燃料点在if(是)块中创建一个select标记,然后计算用户购买杂货的花费。
05
2022-12
02
2022-12
02
2022-12
29
2022-11
29
2022-11
24
2022-11