Home  >  Q&A  >  body text

How to configure bootstrap for php

I just tried starting with php and bootstrap but for some reason my site doesn't recognize bootstrap. It doesn't use its design but simple html. this is mine index.php looks like:

<!DOCTYPE html>
<html lang="en">
<head>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0-beta1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-0evHe/X+R7YkIZDRvuzKMRqM+OrBnVFBL6DOitfPri4tjfHxaWutUpFmBp4vmVor" crossorigin="anonymous">
    <title></title>

    </head>
    <body>
    <script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.11.5/dist/umd/popper.min.js" integrity="sha384-Xe+8cL9oJa6tN/veChSP7q+mnSPaj5Bcu9mPX5F5xIGE0DVittaqT5lorf0EI7Vk" crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0-beta1/dist/js/bootstrap.min.js" integrity="sha384-kjU+l4N0Yf4ZOJErLsIcvOU2qSb74wXpOhqTvwVx3OElZRweTnQ6d31fXEoRD1Jy" crossorigin="anonymous"></script>
    </body>
    </html>

This is what I want the page to look like as a component:

<form role="form" method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>">
    <div class="form-group row">
        <label for="inputEmail" class="col-sm-2 col-form-label">Email</label>
        <div class="col-sm-10">
            <input type="email" class="form-control" id="inputEmail" name="email" placeholder="Email">
        </div>
    </div>
    <div class="form-group row">
        <label for="inputUser" class="col-sm-2 col-form-label">User Name</label>
        <div class="col-sm-10">
            <input type="text" class="form-control" id="inputUser" name="user" placeholder="Username">
        </div>
    </div>
    <div class="form-group row">
        <label for="inputPassword3" class="col-sm-2 col-form-label">Password</label>
        <div class="col-sm-10">
            <input type="password" class="form-control" id="inputPassword" name="password" placeholder="Password">
        </div>
    </div>
    <div class="form-group row">
        <div class="offset-sm-2 col-sm-10">
            <input type="submit" value="Sign in" name="submit" class="btn btn- 
         primary"/>
        </div>
    </div>
</form>

Can someone take a look at my error and tell me what's wrong?

P粉418351692P粉418351692238 days ago411

reply all(1)I'll reply

  • P粉587970021

    P粉5879700212024-01-30 00:18:26

    Judging from what you posted, there is no problem.

    You may need to check your internet connection as well as your browser. Tried it here and it worked really well. If the problem persists, try downloading the bootstrap zip package, opening it in the project directory and linking it to your page manually.

    reply
    0
  • Cancelreply