1

I have made the HTML webpage and a search bar on my local machine, and am going to download XAMPP to host it locally.

The database will be on a VM and played through a hypervisor. I will be using the webpage and a single searchbar to look up names and associated devices with an 8 digit number on the device, called an asset ID.

A friend recommended PDO for a query language for the database, so would this prove better?

NOTE - database not yet operational or connected to. Just got the assignment yesterday.

HTML

<!DOCTYPE html>
<html>
  <style type="text/css">
                html, body {
                height: 100%;
                margin: 0;
                padding: 0;
                color: #FFFFFFFF;
                }
                img#bg {
                position: fixed;
                top: 0;
                left: 0;
                width: 100%;
                height: 100%;
                }
                #content {
                position: relative;
                z-index: 1;
                text-align:center;
                }
  </style>
<head>
  <title>Multigress Asset Management</title>
  <!--[if IE 6]>
<style type="text/css">
html { overflow-y: hidden; }
body { overflow-y: auto; }
img#bg { position:absolute; z-index:-1; }
#content { position:static; }
</style>
<![endif]-->
</head>
<body>
    <img src="F:\CAPSTONE PROJECT\background img.jpg" alt="background image" id="bg" />
    <div id="content">
        <h1>Multigress Asset Management</h1>
        <h4>Search by First Name, Last Name, or Asset ID</h4>
        <form action="" method="post">
            <input type="text" name="data">
            <input type="submit" value="Search">
        </form>
        <br />
        <img src="F:\CAPSTONE PROJECT\Logo2.1.png" alt="Multigress Logo 2.1" width="200" height="100">
        <h5>Copyright 2014-2017 | Date Last Updated: 4/27/2015</h5>
        <h5>By viewing this page, you agree to the <A href="terms&conditions.html">Terms & Conditions</A>.</h5>
  </div>
</body>
</html>

PHP

<?php
if(isset($_GET['data']) && $_GET['data']=='yes')
{
     echo "<center><font color='red'>Comment Posted!</font></center>";
}
else
{
     echo "<center><font color='red'>Username taken!</font></center>";
}
?>

Different stuff I'm playing around with:

$con=mysqli_connect("localhost","root","password","dtabasename");

$getUsers = $DBH->prepare("SELECT * FROM TABLE ORDER BY id ASC");
$getUsers->fetchAll();
Your Common Sense
  • 156,878
  • 40
  • 214
  • 345
Vandal
  • 903
  • 1
  • 14
  • 27

1 Answers1

0

In order to do so, you will need to generate a with an to send the data and then collect it into your PHP file.

HTML:

<form action="submit.php" method="post">
  <input type="text" name="search" />
  <input type="submit" value="Submit" />
</form>

PHP:

<?php
if(isset($_POST['search']){
  //do database request here
 $db=mysql_connect ("servername",  "<username>", "<password>") or die ('I cannot connect  to the database because: ' . mysql_error()); 
 $sql="SELECT * FROM Search WHERE  FirstName LIKE '%" . $name . "%' OR LastName LIKE '%" . $name  ."%'"; 
}
?>

Step by Step tutorial: http://www.webreference.com/programming/php/search/2.html

Hope it helps

Llogari Casas
  • 942
  • 1
  • 13
  • 35