简体   繁体   English

表格php / html将单选按钮发送到html电子邮件中,也未填写项目(单选按钮)

[英]Form php/html send radio buttons into html email also not filled in items (radio buttons)

I want to fill in this form / but when filled in i want it to send me all the radio buttons (images) and also the not filled in buttons. 我想填写此表格/但填写后,我希望它向我发送所有单选按钮(图像)以及未填写的按钮。

for example i get options radio - no - yes - maybe 例如我可以选择收音机-否-是-也许

clicked on maybe. 点击也许。 When the mail has been send i get it as HTML. 发送邮件后,我将其作为HTML接收。 looks good. 看起来不错。 but now i want even the image (radiobutton) to be send with the data and also the not filled in items: This is how i want to get it in my email.. - no - yes |-| 但是现在我什至希望将图像(单选按钮)与数据一起发送,并且也要与未填写的项目一起发送:这就是我想要在电子邮件中获取它的方式。-否-是|-| maybe 也许

This is part of the code: 这是代码的一部分:

$message .= "<tr><td><strong>Algemene indruk werkkleding</strong> </td><td>" . strip_tags($_POST['nr8']) . "</td></tr>\r\n";
$message .= "<tr><td><strong>Logboek afgetekend</strong> </td><td>" . strip_tags($_POST['nr9']) . "</td></tr>\r\n";
$message .= "<tr><td><strong>Materialen gekeurd</strong> </td><td>" . strip_tags($_POST['nr10']) . "</td></tr>\r\n";

And how it looks on the HTML part: 以及它在HTML部分上的外观:

    <div class="rowElem">
        <label for="nr6">Algemene indruk werkkast</label>
            <input type="radio" name="nr6" value="Goed">
            <label>Goed</label>
            <input type="radio" name="nr6" value="Matig">
            <label>Voldoende</label>
            <input type="radio" name="nr6" value="Niet Goed">
            <label>Onvoldoende</label>
            <input type="radio" name="nr6" value="NVT">
            <label>NVT</label>
    </div>

            <div class="rowElem">
        <label for="nr7">Algemene indruk werkwagen</label>
            <input type="radio" name="nr7" value="Goed">
            <label>Goed</label>
            <input type="radio" name="nr7" value="Matig">
            <label>Voldoende</label>
            <input type="radio" name="nr7" value="Niet Goed">
            <label>Onvoldoende</label>
            <input type="radio" name="nr7" value="NVT">
            <label>NVT</label>
    </div><br>

I really hope someone can help me if you need a link where the code is: 我真的希望有人在您需要包含以下代码的链接时为我提供帮助:

www.lubke.nl/form/index.php This is where it is standing: Im sorry if I sound like a rooky but this is one of my first forms made for myself. www.lubke.nl/form/index.php这就是它的位置:对不起,如果我听起来像个菜鸟,但这是我为自己制作的第一批表格之一。

You could just fill in the blanks server side when you receive the POST. 您可以在收到POST时填写空白服务器端。 If you know the entirety of the values, you could simply combine that with what you receive. 如果您知道所有值,则可以将其与接收到的内容简单地结合在一起。

$baseValues = ['nr1' => '', 'nr2' => '', 'nr3' => '', ...];

$baseValues = array_merge($baseValues, $_POST);

//build your email using the $baseValues, rather than $_POST...

Another common workaround would be to use hidden inputs to maintain actual values and use check-boxes/radio buttons to just manipulate the value of the corresponding hidden inputs. 另一个常见的解决方法是使用隐藏的输入来维护实际值,并使用复选框/单选按钮仅操纵相应隐藏输入的值。 But that would require additional work on the client side with JS. 但这需要使用JS在客户端进行更多工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM