这是我的引导代码:
<form clas="form-horizontal" roles="form" name="login" action="submitticket.php" method="post" accept-charset="uft-8">
<div class="form-group">
<label class="control-label col-sm-2" for="title">Title</label>
<div class="col-sm-6">
<input type="text" class="form-control" name="title" placeholder="" required maxlength="100" required>
</div>
</div>
<div class="form-group">
<label class="control-label" for="description">Description</label>
<div class="col-sm-6 col-sm-offset-2">
<textarea class="form-control" name="description" rows="4" cols="50" maxlength="255">
</textarea>
</div>
</div>
<div class="form-group">
<label class="control-label" for='category'>Category</label>
<div class="col-sm-6 col-sm-offset-2">
<select class="form-control" name="category">
<option value="">--- Select ---</option>
<?php
$sql = mysql_query("SELECT cat_name FROM Category");
while ($row = mysql_fetch_array($sql)){
echo "<option value='".$row['cat_name']."'>".$row['cat_name']."</option>";
}
?>
</select>
</div>
</div>
<div class="form-group">
<label class="control-label" for='urgency'>Urgency</label>
<div class="col-sm-6 col-sm-offset-2">
<select class="form-control" name="urgency">
<option value="">--- Select ---</option>
<?php
$sql = mysql_query("SELECT urg_name FROM Urgency");
while ($row = mysql_fetch_array($sql)){
echo "<option value='".$row['urg_name']."'>".$row['urg_name']."</option>";
}
mysql_close($con);
?>
</select>
</div>
</div>
<br>
<input type="hidden" name="username" value="<?php echo $myusername; ?>">
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-default">Submit Ticket</button>
</div>
</div>
</form>
它没有按预期出现。所有内容的标签,但标题字段显示在“上一行”,即“描述”标签显示在标题文本框的右侧,“类别”标签显示在描述文本区域右侧和“Urgnecy” “出现在类别下拉菜单的右侧。我该如何解决这个问题。它不会发生在我的任何其他形式上,我认为它与混合不同类型的字段有关。
答案 0 :(得分:0)
请更正:
<form class="form-horizontal"
你这里有一个错字:
<form clas="form-horizontal"
以这种方式塑造你的表单:
<form class="form-horizontal" role="form">
<div class="form-group">
<label class="control-label col-sm-2" for="email">Email:</label>
<div class="col-sm-10">
<input type="email" class="form-control" id="email" placeholder="Enter email">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="pwd">Password:</label>
<div class="col-sm-10">
<input type="password" class="form-control" id="pwd" placeholder="Enter password">
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<div class="checkbox">
<label><input type="checkbox"> Remember me</label>
</div>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-default">Submit</button>
</div>
</div>
</form>