基本上,我页面上的所有内容都成为包含所有文本的引导按钮 - 而不仅仅是文本本身。我相信这是因为我为按钮添加了href
,但这是该页面的屏幕截图:
正如您所看到的,每个白框中的所有内容都是绿色按钮,这是错误的。
这是我在这个页面的php代码:
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" integrity="sha384-fLW2N01lMqjakBkx3l/M9EahuwpSfeNvV63J5ezn3uZzapT0u7EYsXMjQV+0En5r" crossorigin="anonymous">
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>
<?php
session_start();
include "init.php";
$page_title = 'Products';
$query = "SELECT productID, name, description, price
FROM products";
$result = mysqli_query($dbcon, $query);
print
"<div class='navbar navbar-inverse navbar-fixed-top'>".
"<div class = 'container'>".
"<button type='button' class='navbar-toggle' data-toggle='collapse' data-target='.navbar-collapse'>".
"<span class='sr-only'>Toggle navigation</span>".
"<span class='icon-bar'></span>".
"<span class='icon-bar'></span>".
"<span class='icon-bar'></span>".
"</button>".
"</div>".
"</div>".
"<div class='page-header'>".
"<div class='page-header'>".
"</div>".
"</div>";
if(mysqli_num_rows($result)){
while($row = mysqli_fetch_assoc($result)){
print
"<div id='products' class='row list-group'>".
"<div class='item col-xs-4 col-lg-4'>".
"<div class='thumbnail'>".
"<img class='group list-group-image' alt='' />".
"<div class='caption'>".
"<h4 class='group inner list-group-item-heading'>
'Title 1'</h4>".
"<p class='group inner list-group-item-text'>
Sample.</p>".
"<div class='row'>".
"<div class='col-xs-12 col-md-6'>".
"<p class='lead'>
654</p>".
"</div>".
"<div class='col-xs-12 col-md-6'>".
"<a href='baskets.php' input type='submit' value='Add to basket' class='btn btn-success btn-block btn-lg' >".
"</div>".
"</div>".
"</div>".
"</div>".
"</div>";
}
}
else{
}
?>
我是网络开发的新手,我不明白为什么href
造成了这种情况。我需要href
,因为当用户点击Add the Basket
按钮时,baskets.php
必须执行
答案 0 :(得分:0)
您使用过:
"<a href='baskets.php' input type='submit' value='Add to basket' class='btn btn-success btn-block btn-lg' >"
您在锚标记内使用input
,type
这不应该发生。而且你因为自举课而得到了绿色按钮。
将以上行替换为:
"<a href='baskets.php'>Add to basket</a>"
答案 1 :(得分:0)
<a href='baskets.php'><button class='btn btn-success btn-block btn-lg'>Add to basket</button></a>