Solved

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

Posted on 2015-02-06
4
92 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
ID: 40595133
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
ID: 40595136
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
ID: 40601363
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
ID: 40601787
Basic info, I did not think of..
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
Because your company can’t afford for you to make SEO mistakes, you’ll want to ensure you’re taking the right steps each and every time you post a new piece of content. This list of optimization do’s and don’ts can help you become an SEO wizard.
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

810 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