Solved

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

Posted on 2015-02-06
4
94 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Suggested Solutions

Title # Comments Views Activity
ebay messages api 6 40
Word Press Fixes to Google Speed Test Issues 2 50
isNaN issue on the Table input text 2 41
Replace statements HTML with HTML IF 8 63
Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
Color can increase conversions, create feelings of warmth or even incite people to get behind a cause. If you want your website to really impact site visitors, then it is vital to consider the impact color has on them.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…

734 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