【问题标题】:How can I display the checked boxes of an email form in my email body message?如何在我的电子邮件正文中显示电子邮件表单的复选框?
【发布时间】:2019-05-18 04:54:42
【问题描述】:

我正在尝试创建一个联系我们的表单。我有一些文本输入字段、下拉菜单和复选框。在进行故障排除时,我可以从文本框输入和下拉菜单中提取文本。不幸的是,当我尝试从添加到电子邮件正文的复选框中获取值时,我的代码中断了。提交表单时,如何在我的电子邮件正文中包含带有“已选中”值的框?下面是一个示例代码。谢谢你的帮助。

<head>
msg.Subject = "Test Form";
    msg.Body = "\n Name: " + txtname.Text + Environment.NewLine + "\n Color: " + color.Text + Environment.NewLine + "\n Shape " + shape.Value;
</head>    
<body>
<asp:TextBox AlternateText="Name Field" id="txtname" runat="server" 
        MaxLength="32" placeholder="Name" alt="Name*" type="text" > 
        </asp:TextBox>
        <asp:DropDownList id="color" runat="server" AlternateText="Color Field" 
        placeholder="Color" alt="Color Field" type="text" >
              <asp:ListItem Text="Blue" Value="blue" />
              <asp:ListItem Text="Red" Value="red" />
              <asp:ListItem Text="White" Value="white" />
            </asp:DropDownList>
<fieldset>        
        <label for="circle">Circle<input type="checkbox" name="shape" id="circle">
        </label>
        <label for="square">Square<input type="checkbox" name="shape" id="square">
        </label>
        <label for="triangle">Triangle<input type="checkbox" name="shape" id="triangle">
        </label>
</fieldset>
</body>

【问题讨论】:

    标签: forms email checkbox input


    【解决方案1】:

    我终于能够从此页面找到解决方案: https://forums.asp.net/t/1825115.aspx?How+do+I+get+Checkbox+values+and+email+them+

    <head>
    msg.Subject = "Test Form";
        msg.Body = "\n Name: " + txtname.Text + Environment.NewLine + "\n Color: " + color.Text + Environment.NewLine + "\n Shape " + Request["shape"];
    </head>  
    

    【讨论】:

      猜你喜欢
      • 2013-06-08
      • 2016-01-20
      • 1970-01-01
      • 2022-08-24
      • 1970-01-01
      • 2012-08-18
      • 1970-01-01
      • 1970-01-01
      • 2013-07-01
      相关资源
      最近更新 更多