【发布时间】:2018-02-05 06:27:59
【问题描述】:
我一直在试图弄清楚通过电子邮件发送单选按钮和复选框时是否需要去掉(清理?)以及如何去做。
我有一个仅通过电子邮件发送信息的联系表。它不涉及数据库。发送电子邮件时是否需要保护单选按钮和复选框?有可能吗?
我在谷歌上没有找到任何关于在给他们发送电子邮件时保护这些内容的信息。我不断遇到一些答案,说在发送到数据库时绝对应该受到保护。在这里可以找到相同的内容,或者有关如何获取值或动态创建值的问题。所以,我很茫然。
发送电子邮件时,我是否保护单选按钮和复选框?可能吗?必要的?如果是这样,我该怎么做?
这是我的部分代码的样子:
$firstName = strip_tags($_POST['firstName']);
$lastName = strip_tags($_POST['lastName']);
$email = strip_tags($_POST['emailAddress']);
$telNum = strip_tags($_POST['phoneNumber']);
$colors= $_POST['eColors'];
$additionalComments = strip_tags($_POST['additionalComments']);
$spamField = strip_tags($_POST['sField']);
<form id="contact-form" action="" method="post">
<div>
<input type="text" id="nameFirst" name="firstName" />
<label for="nameFirst" class="nameIcon">
<span>First Name</span>
</label>
<span class="hint">
<p>Input hint goes here</p>
</span>
</div>
<div>
<input type="text" id="nameLast" name="lastName" />
<label for="nameLast" class="nameIcon">
<span>Last Name</span>
</label>
<span class="hint">
<p>Input hint goes here</p>
</span>
</div>
<div>
<input type="email" id="eAddy" name="emailAddress" />
<label for="eAddy" class="emailIcon">
<span>Contact Email</span>
</label>
<span class="hint">
<p>Input hint goes here</p>
</span>
</div>
<div>
<input type="tel" id="telNum" name="phoneNumber" />
<label for="telNum" class="contactIcon">
<span>Contact Number</span>
</label>
<span class="hint">
<p>Input hint goes here</p>
</span>
</div>
<div>
<input type="checkbox" id="cbEColors" name="eColors" class="cbSwitch" />
<label for="cbEColors">Do you expect more color?</label>
</div>
<div>
<textarea id="addComments" name="additionalComments"></textarea>
<label for="addComments" class="messageIcon">
<span>Additional Comments</span>
</label>
<span class="hint">
<p>Input hint goes here</p>
</span>
</div>
<input type="text" id="sField" class="col" name="sField" />
<button id="submit" name="submit" type="submit" value="Submit">Submit</button>
</form>
【问题讨论】:
标签: php html checkbox radio-button