Jump to content

PHP code in html Index page


rocky48
Go to solution Solved by Jessica,

Recommended Posts

Hi

 

I am trying to include a script that I have tested on its own (and works fine), into the index.html page of my website.

 

I am placing it in an Aside (on the left), when I run this on my ISP test folder it does not work.

 

It displays the code from the first row of the table to the heading in the following html code.

 

I can't spot anything obvious, so what is causing this error.

 

This is the code I am running:

<!--<?php
require_once('mobile_device_detect.php');
mobile_device_detect('http://www.1066cards4u.co.uk/index1.html','http://www.1066cards4u.co.uk/index1.html','http://www.1066cards4u.co.uk/index1.html',false,'http://www.1066cards4u.co.uk/index1.html','http://www.1066cards4u.co.uk/index1.html','http://www.1066cards4u.co.uk/index1.html','http://www.1066cards4u.co.uk/index1.html',false);
?>-->
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
    <meta name="Description" content="Ecologic Theme">
    <meta name="author" content="CoffeeCup Software, Inc.">
    <meta name="Copyright" content="Copyright (c) 2011 CoffeeCup, all rights reserved.">
	 <link rel="shortcut icon" href="favicon.ico" >
   <link rel="icon" type="image/gif" href="animated_favicon1.gif" >
    <title>1066 Cards 4 U - Home</title>
    <link rel="stylesheet" href="stylesheets/default.css" />
    <!--[if IE]>
    <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
</head>
<body>
	<div id="fb-root"></div>
<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_GB/all.js#xfbml=1";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
    <header>
        <h1><a href="index.html"> ..............</a></h1></br></br></br></br>
		<div><img src="images/1066Green.jpg" width="600" height="80" alt="" title="" border="0" /></div>
        
    </header>
<section id= "sidebarR" class= clear>
	
    <asideR>		
<?php
include("RelHol_connect.php");
doDB();
$get_Event_sql  = "SELECT Events.ID, Events.Event_Date, Events.Event_Description, Religion.ID, Religion.Religion
	FROM Events
	LEFT JOIN Religion
	ON Religion.ID = Faith_ID
	WHERE MONTHNAME(Events.Event_Date)= MONTHNAME(Now())
	ORDER BY Events.Event_Date ASC";
$get_Event_res = mysqli_query($mysqli, $get_Event_sql) or die(mysqli_error($mysqli));	
//create the display string
	$display_block = "
	<table width=\"30%\" cellpadding=\"3\" cellspacing=\"1\" border=\"1\" BGCOLOR=\"#87CEEB\">
	<tr>
	<th>Date</th>
	<th>Event</th>
	<th>Faith</th>
	</tr>";

	while ($Event_info = mysqli_fetch_array($get_Event_res)) {
		$Event_Date = $Event_info['Event_Date'];
		$Event_text = nl2br(stripslashes($Event_info['Event_Description']));
		$Faith = $Event_info['Religion'];
		
		//add to display
	 	$display_block .= "
		<tr>
		<td width=\"5%\" valign=\"top\">".$Event_Date."</td>
		<td width=\"30%\" valign=\"top\">".$Event_text."</td>
		<td width=\"15%\" valign=\"top\">".$Faith."</td>
		</tr>";
	}

	//free results
	mysqli_free_result($get_Event_res);


	//close connection to MySQL
	mysqli_close($mysqli);

	//close up the table
	$display_block .= "</table>";
?>
    
<h2>Religious Holidays & Festivals</h2>

<?php echo $display_block; ?>

    </asideR>
</section> 
	
<section id= "sidebarL" class= clear>
	
<asideL>		
<div class="fb-like" data-href="http://www.1066cards4u.co.uk" data-send="true" data-layout="box_count" data-width="300" data-show-faces="true" data-font="arial"></div>
</asideL>
</section	
    <section id="mainContent" class="clear">
	
        <nav>
            <h3>Main Menu</h3>
           <p><ul>
                <li><a href="index.html">Home</a></li>
                <li><a href="Links.html">Links</a></li>
                <li><a href="Techniques.html">Techniques</a></li>
				<li><a href="Verse_Menu.html">Verse's</a></li>
                <li><a href="contact.html">Contact Us</a></li>
				<li><a href="News.html">News</a></li>
				<li><a href="AboutUs.html">About Us</a></li>
				<li><a href="Gallery.html">Gallery</a></li>
				<li><a href="index1.html">iPad users</a></li>
            </ul></p>
</br>
<h2 style="text-decoration:blink; color: red">NEWS FLASH!</h2>
<h4><font color="red">I have been working on an iPad version of the web site, which is almost ready to roll.  However if you have an iPad and want to use this you can access it by clicking on the link above or in the page footer (Sometimes the main link does not work).  I am trying to solve some coding problems that auto detects mobile devices, which will automatically redirect to the iPad code.</h4>
<!--<h4><font color="red">NEW LOOK website!</br>Smarter looking site, but unfortunately as the Forum has not been used since the launch we have decided to remove it.</br>However if you have any ideas or suggestions please use the Feedback Form on the contact us tab.</h4>-->
<h4><font color="blue">We have made many minor changes - so please see NEWS page for details (Bulletin #.</font> </h4>
<h4><font color="blue"> </br>For instructions on how to use the Verse Printing Utility! SEE NEW INSTRUCTION PDF file. ( Version 2.9 - 28th November 2012)</font> </h4>
<h4><font color="blue"></br>A form for adding verses has been added to the Contact Us page! </font> </h4>
        </nav>
	
		<section id="mainLeft">
		<div><img src="images/B1012F.jpg" width="250" height="250" alt="" title="" border="0" />
		</div>
		<br />  
			             
                <h1>Welcome to our site</h1>
               </br> 
		
		<p>We are passionate about card making and we would like to invite you to share your interests in card making with us.</br> 
		</br>
		On our Website we have many interesting items on our site that we think will be of interest to you.
		
		<ul TYPE=SQUARE>
		<li>Some links to suppliers websites</li>
		<li>Many articles on card making techniques</li>
		<li>A unique utility which allows you to print greetings verse for your cards</li>
		<li>Database of nearly 1000 verses</li>
		<li>The ability to type in your own verse</li>
		<li>Videos on card-making techniques in our Gallery</li>
		<li>Feedback facility to allow visitors to comment on our site</li>
		</ul>
		</p>
		</br>
		<p>We hope that you will enjoy our site and you will visit us again SOON!</p>
            
        </section>
        <!-- end mainLeft -->
    </section>
    <!-- end mainContent -->
    <footer>
	
	
        <p>© 2011 Ecologic, Inc. All rights reserved.    <a href="http://coffeecup.com">HTML Editor Theme</a> by CoffeeCup Software.</br> © 2012 Content:1066 Cards 4U. All rights reserved.   </p>
        <ul>
            	<li><a href="index.html">Home</a></li>
                <li><a href="Links.html">Links</a></li>
                <li><a href="Techniques.html">Techniques</a></li>
				<li><a href="Verse_Menu.html">Verse's</a></li>
                <li><a href="contact.html">Contact Us</a></li>
				<li><a href="News.html">News</a></li>
				<li><a href="AboutUs.html">About Us</a></li>
				<li><a href="Gallery.html">Gallery</a></li>
				<br />
				<li><a href="index1.html">iPad users</a></li>
        </ul>
		
    </footer>
	</br> </br> </br> </br> 


</body>
</html>


The added code is in red.

 

 

 

Link to comment
Share on other sites

Hi

 

Tried changing to php extension but did not work, just got a blank page.

 

Have never used mod_rewrite which I understand is an Apache utility.  I don't know what server my ISP uses, but am checking with them.

How do you make the webserver parse the html page as php?

Link to comment
Share on other sites

  • Solution

Hi

 

Tried changing to php extension but did not work, just got a blank page.

 

Have never used mod_rewrite which I understand is an Apache utility.  I don't know what server my ISP uses, but am checking with them.

How do you make the webserver parse the html page as php?

Did you check the error log? Does your server have PHP? You need to talk to your host.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.