簡體   English   中英

HTML 表單 - 輸入類型隱藏在 PHP 后輸入不起作用

[英]HTML Form - Input Type hidden with PHP post input not working

澄清:

我有一個表格可以這樣說:

<form method="post" action="https://www.example.at/example/" id="comparison">
<input type="radio" id="region" name="region" value="austria">
<input type="radio" id="region" name="region" value="germany">
<input type="radio" id="tarif" name="tarif" value="Basis">
<input type="radio" id="tarif" name="tarif" value="Comfort">
<input type="submit" name="submit" value="compare">
</form>

用戶可以提交 - 工作正常。

在第二頁 ( https://www.example.at/example/ ) 我想拿起可變區域 但我希望用戶再次能夠在基礎和舒適之間切換。 所以值域不再被輸入。

<form method="post" id="comparison2">
<input type="hidden" name="region" id="region" value="<?php echo_POST['region']; ?>" />
<input type="radio" id="tarif" name="tarif" value="Basis">
<input type="radio" id="tarif" name="tarif" value="Comfort">
<input type="submit" name="submit" value="compare">
</form>

因此,如果我回顯帶有區域的 php,它會在表格之外為我提供正確的值。 盡管在提交第二個表單后它會觸發一個 php 短代碼(再次)並再次提交,它會顯示我們數據庫中的 € 值。

但即使它與用戶輸入的輸入(第一步)正常工作,它也不會使用或以不同方式使用隱藏輸入。

如果有幫助:我目前正在這里測試: https://www.krankenversichern.at/testing-environment/

所以解決方案是:我把我所有的 html 代碼放在一個簡碼中。 我按照建議使用了 php 回聲,並在 elementor 中使用了文本元素小部件。 而已。 大概花了2分鍾!

暫無
暫無

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

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