在我的表单内,有以下行:
<textarea rows="5" class="form-control" class="text" placeholder="Message" name="comments" required data-validation-required-message="Please enter a message."></textarea>
但是,它没有传递给动作php文件。变量$ _POST ['comments']回显为空。
除此值外,其余所有值都起作用。似乎无法解决,任何帮助都会很大。
谢谢。
表格:
<form name="sentMessage" id="contactForm" action="mail/contact_me.php" method="post">
<div class="row control-group">
<div class="form-group col-xs-12 floating-label-form-group controls">
<label>Name</label>
<input type="text" class="form-control" placeholder="Name" id="name" name="name" required data-validation-required-message="Please enter your name.">
<p class="help-block text-danger"></p>
</div>
</div>
<div class="row control-group">
<div class="form-group col-xs-12 floating-label-form-group controls">
<label>Contact Number</label>
<input type="text" class="form-control" placeholder="Contact Number" id="contactNo" name="contactNo" required data-validation-required-message="Please enter a contact number.">
<p class="help-block text-danger"></p>
</div>
</div>
<div class="row control-group">
<div class="form-group col-xs-12 floating-label-form-group controls">
<label>Email Address</label>
<input type="text" class="form-control" placeholder="Email Address" id="email" name="email" required data-validation-required-message="Please enter your email address.">
<p class="help-block text-danger"></p>
</div>
</div>
<div class="row control-group">
<div class="form-group col-xs-12 floating-label-form-group controls">
<label>Message</label>
<textarea rows="5" class="form-control" class="text" placeholder="Message" name="comments" required data-validation-required-message="Please enter a message."></textarea>
<p class="help-block text-danger"></p>
</div>
</div>
<br>
<div id="success"></div>
<div class="row">
<div class="form-group col-xs-12">
<input type="submit" name="submit" value="Submit">
</div>
</div>
</form>
答案 0 :(得分:1)
如果您不了解HTML表单,我们只能做一些假设。我非常确定您的textarea不是表单的一部分,也不是表单节点的后代,或者它是使用CSS的display: none
设置样式的。