Solved

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

Posted on 2015-02-06
4
86 Views
Last Modified: 2015-02-10
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
Comment
Question by:Scott Johnston
  • 2
  • 2
4 Comments
 
LVL 42

Accepted Solution

by:
Rob Jurd, EE MVE earned 500 total points
Comment Utility
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
 
LVL 42

Expert Comment

by:Rob Jurd, EE MVE
Comment Utility
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
 

Author Comment

by:Scott Johnston
Comment Utility
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
 

Author Closing Comment

by:Scott Johnston
Comment Utility
Basic info, I did not think of..
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now