• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 98
  • Last Modified:

How to insert a Home button..............

I have a small PHP script that produces a a view of data, I not sure on the proper way to have HOME button on the top of the web page.
If I was using HTML I think I could get the button added correctly.
In PHP I have a short learning curve.....

<?php
  $con=mysqli_connect("domain.com","username","password","database");
 // Check connection
 if (mysqli_connect_errno())
   {
   echo "Failed to connect to MySQL: " . mysqli_connect_error();
   }

$result = mysqli_query($con,"SELECT RegDate, FirstName, LastName, EmailAddress, PhoneNumber, CECredits, CampaignID FROM OpenHouseRegistrations order by Regdate ASC");

 echo "<table border='1'>
 <tr>
 <th>Reg Date</th>
 <th>First Name</th>
 <th>Last Name</th>
 <th>Email Address</th>
 <th>Phone Number</th>
 <th>CEU Credits</th>
 <th>CampaignID</th>

 </tr>";

 while($row = mysqli_fetch_array($result))


   {
   echo "<tr>";
   echo "<td>" . $row['RegDate'] . "</td>";
   echo "<td>" . $row['FirstName'] . "</td>";
   echo "<td>" . $row['LastName'] . "</td>";
   echo "<td>" . $row['EmailAddress'] . "</td>";
   echo "<td>" . $row['PhoneNumber'] . "</th>";
   echo "<td>" . $row['CECredits'] . "</th>";
   echo "<td>" . $row['CampaignID'] . "</th>";
   //echo "<td>" . $row['<input type="submit" value="Send." name="submit" style="background:#ee2869; color:#FFF']."</th>";
   echo "</tr>";
   }
 echo "</table>";

 mysqli_close($con)

Open in new window

0
Scott Johnston
Asked:
Scott Johnston
  • 2
  • 2
1 Solution
 
RobOwner (Aidellio)Commented:
This is obviously part of a larger page?  As a basic start you should define a header.php, footer.php and include your content based on whatever page you're on:

so a typical php page would appear like this:

<?php
include('html_content.php'); // contains functions to output the <head> and generic html structure tags etc with the required css,js etc
include('header.php'); // this contains page specific headers and menus
include('footer.php'); // 

html_header('title of the page', array('js'=>array('js/jquery.js','js/bootstrap.js'), 'css'=>array('css/jquery-ui.css','css/bootstrap.css');  // this outputs the doctype and <head>...</head> and scripts, css and page title

?>
<body>
<?php 
    page_header(); // output the banner at the top of the page if you have one

    nav_menu('Home'); // output the navigation with the current page highlighted
    
    include('page_to_show.php'); // include the view for this page
    
    page_footer(); // show the footer for the page
?>
</body>
</html>

Open in new window

0
 
RobOwner (Aidellio)Commented:
Can you show your encapsulating php code that include this php?

You may also want to think about a MVC based structure like Laravel, CakePHP or Codeignitor
0
 
Scott JohnstonSystems ConsultantAuthor Commented:
This is the only program I run, I like the idea about header and footer.  I will have to learn something more.  I am looking at Cake PHP to see if a application like this can help, I have link inserted on home page I created, all the program does right now is return the data in the MySQL database so our marketing team can review, however once the data is generated, they have now way to get back the home page without using the back button within internet explorer, or to retype the url for our Intranet.
0
 
Scott JohnstonSystems ConsultantAuthor Commented:
Basic info, I did not think of..
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now