Solved

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

Posted on 2015-02-06
4
93 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 43

Accepted Solution

by:
Rob 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 43

Expert Comment

by:Rob
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

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

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

Developer portfolios can be a bit of an enigma—how do you present yourself to employers without burying them in lines of code?  A modern portfolio is more than just work samples, it’s also a statement of how you work.
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 videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

830 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