Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
- <!-- Bootstrap -->
- <link href="css/bootstrap.min.css" rel="stylesheet">
- <link href="css/style.css" rel="stylesheet">
- </script>
- <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
- <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
- <!--[if lt IE 9]>
- <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
- <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
- <![endif]-->
- </head>
- <body>
- <h3 style="color:white;">Search CRF:</h3>
- <?php
- $servername = "localhost";
- $username='root';
- $password = "";
- $dbname = "official_db";
- $mysqli = new mysqli($servername,$username, Null, $dbname);
- if ($mysqli->connect_error) {
- die("Connection failed: " . $mysqli->connect_error);
- }
- ?>
- <form id="searchform" method="post" action = '' target="search.php">
- <input id="Cref" style="height: 25px; width: 140px; position: fixed; top: 150px; left: 50px" name="name" type="text" >
- <input type="submit" value="Search" class="btn btn-primary btn" style="color: white; font-style: normal; background-color: blueviolet; position: fixed; top: 148px; left: 220px">
- </form>
- <?php
- $name = '';
- if(! get_magic_quotes_gpc() ) {
- $name = isset($_POST['name']) ? trim( addslashes($_POST['name'])) : '';
- }else {
- $name = isset($_POST['name']) ? trim($_POST['name'])) : '';
- }
- session_start();
- $results="SELECT * FROM tbl WHERE Name LIKE '%$name%'";
- $resultSet = $mysqli->query($results);
- $numRows = $resultSet->num_rows;
- if ($numRows < 0) {
- echo "No Results";
- }
- else
- {
- ?>
- <div class="col-md-6 col-md-offset-6">
- <table class="table table-hover" style='background-color:antiquewhite'>
- <thead>
- <tr>
- <th style="color: black;">NAme</th>
- <th style="color: black;">Address</th>
- <th style="color: black;">County</th>
- </tr>
- </thead>
- <tbody>
- <?php
- while ($row = $resultSet->fetch_object()) {
- ?>
- <tr>
- <td><?php echo "{$row->CRF} " ?></td>
- <td><?php echo "{$row->Host} " ?></td>
- <td><?php echo "{$row->Description} " ?></td>
- </tr>
- <?php }
- ?>
- </tbody>
- </table>
- <div>
- <?php
- }
- ?>
- <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
- <!-- Include all compiled plugins (below), or include individual files as needed -->
- <script src="js/bootstrap.min.js"></script>
- </body>
- </html>
Add Comment
Please, Sign In to add comment