Search code examples
phphrefbootstrapping

Everything on my page becomes a bootstrap button rather than just the button itself


So basically, everything on my page has become a bootstrap button including all the text - as opposed to just the text itself. I believe it is because I have included a href for the button but this is the screenshot of the page:

enter image description here

As you can see everything in each white box is full of green buttons which is wrong.

This is my php code for this page:

<!-- 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{

}

?>

I am new to web development and I just can't see why the href has caused this. I need the href because when the user clicks the Add the Basket button, the baskets.php has to execute


Solution

  • <a href='baskets.php'><button class='btn btn-success btn-block btn-lg'>Add to basket</button></a>