Jump to content

[SOLVED] multiple <!doctype> through </html> entries !?


Recommended Posts

I just noticed the "view source" code of my html/php/mysql-based website (that I have had online for more than a year) has THREE (duplicate!) HTML doctype,html,header,body entries BEFORE the site's "real" HTML coding ...

 

This is what shows in the "source view" - repeated 3 times! - before the "real" HTML/PHP/MSYQL coding for the site begins:

 

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
</body>
</html>

 

 

Can someone please tell me why this is happening?

What other pieces of information/coding do you need from me to help clarify this for an answer?

 

Thank you so much!

 

"Stumped" GlentheComputerGuy

 

(edited by kenrbnsn to replace the [pre][/pre] tags with


tags)

Link to comment
https://forums.phpfreaks.com/topic/148626-solved-multiple-through-entries/
Share on other sites

OKAY, Ken, here's what you asked for (cut off at the beginning of the generation of the page, but including the open/close of the dbase and related php coding):

 

<?php
include 'library/config.php';
include 'library/opendb.php';

// *************************************************************
// SET THE Category Type ($catType) AS PASSED BY USER SELECTION
// *************************************************************

switch ($_GET["cat"])
{
	case dining: $catType = "Dining & Restaurants"; break;  
	case auto: $catType = "Automotive"; break;
	case hair: $catType = "Hair & Beauty"; break;  
	case health: $catType = "Health & Fitness"; break;
	case home: $catType = "Home Improvement"; break;
	case medical: $catType = "Medical Services"; break;  
	case professional: $catType = "Professional Services"; break;
	case retail: $catType = "Retail & Other Services"; break;
	default: $catType = "Dining & Restaurants";
}

$pageNumber = 1;

switch ($_GET["page"])
{
	case 1: $pageNumber = 1; break;  
	case 2: $pageNumber = 2; break;
	case 3: $pageNumber = 3; break;  
	case 4: $pageNumber = 4; break;
	case 5: $pageNumber = 5; break;
	case 6: $pageNumber = 6; break;
	default: $pageNumber = 1;
}

	$category = ($_GET["cat"]);
	$zoneToBeDisplayed = ($_GET["area"]);

// ***************************************************************************************
// SET THE Page Number ($pageNumber) of $catType BY DEFAULT ***ALL*** OR FROM USER SELECTION
// ***************************************************************************************

//	$pageNumber = 1;	

// *********************************************************************************
// SET THE MAXIMUM NUMBER OF ROWS THAT WILL BE DISPLAYED ON EACH CATEGORY PAGE HERE
// *********************************************************************************

$maxRowsPerPage = 9;

// *************************************************************************************************
// QUERY ADVERTISERS DATABASE (advertisers), SELECTING CATEGORY TO BE DISPLAYED (busType='$catType')
// *************************************************************************************************


switch ($zoneToBeDisplayed)
{
	case 0:
		$query = "SELECT * FROM advertisers0903 WHERE busType='$catType' ORDER BY busName";
		$showArea = "Serving Orange County";
		break;
	case 1:
		$query = "SELECT * FROM advertisers0903 WHERE busType='$catType' && (
			(zone = '0') || (zone = '1') || (zone = '5') || (zone = '6') || (zone = '8'))
			ORDER BY busName";
		$showArea = "Serving Tustin";
		break;
	case 2:
		$query = "SELECT * FROM advertisers0903 WHERE busType='$catType' && (
			(zone = '0') || (zone = '2') || (zone = '5') || (zone = '8') || (zone = 'b') || (zone = 'd'))
			 ORDER BY busName";
		$showArea = "Serving Irvine North";
		break;
	case 3:
		$query = "SELECT * FROM advertisers0903 WHERE busType='$catType' && (
			(zone = '0') || (zone = '3') || (zone = '6') || (zone = '8') || (zone = 'b') || (zone = 'd') || (zone = 'e'))
			 ORDER BY busName";
		$showArea = "Serving Irvine South";
		break;
	case 4:
		$query = "SELECT * FROM advertisers0903 WHERE busType='$catType' && (
			(zone = '0') || (zone = '4') || (zone = '9') || (zone = 'd') || (zone = 'e'))
			 ORDER BY busName";
		$showArea = "Serving Lake Forest";
		break;
	case 5:
		$query = "SELECT * FROM advertisers0903 WHERE busType='$catType' && (
			(zone = '0') || (zone = '7') || (zone = '9'))
			 ORDER BY busName";
		$showArea = "Serving Mission Viejo & RSM";
		break;
	default: 
		$query = "SELECT * FROM advertisers0903 WHERE busType='$catType'  ORDER BY busName";
		$showArea = "Serving Orange County";
}

// *******************************************************************************
// STORE THE SELECTED advertisers by $catType IN AN ARRAY ($advertisersToBeListed)
// *******************************************************************************

$arrayOfAdsToDisplay = @mysql_query($query);

// ************************************************************
// SHOW AN ERROR IF THE ARRAY ($arrayOfAdsToDisplay) IS EMPTY!
// ************************************************************

if (!$arrayOfAdsToDisplay) { exit ('Database error: ' . mysql_error()); }

// *************************************************************************************************************
// DETERMINE THE NUMBER OF ROWS TO BE DISPLAYED ON THE WEB PAGE (FOUND WITHIN THE SELECTED $catType ADVERTISERS)
// *************************************************************************************************************

$totalRowsToDisplay = mysql_num_rows($arrayOfAdsToDisplay);

// **********************************************************************************************
// *IF* THE NUMBER OF ROWS OF ADVERTISERS IS LESS THAN THE NUMBER OF ROWS TO DISPLAY ON ONE PAGE
// THEN SET THE VARIABLE ($totalPagesToDisplay) to 1
// **********************************************************************************************

if ($totalRowsToDisplay <= $maxRowsPerPage) {
	$totalPagesToDisplay = 1;
	$rowsOnLastPage = $totalRowsToDisplay;
}

// ****************************************************************************
// *IF* THERE IS MORE THAN ONE PAGE OF ADVERTISERS TO DISPLAY ON THE SITE
// DETERMINE HOW MANY PAGES ARE TO BE DISPLAYED
// ROUNDING 'UP' IF THERE IS A REMAINDER OF THE FORMULA
// ****************************************************************************

else {
	$rowsOnLastPage = (fmod($totalRowsToDisplay, $maxRowsPerPage));
	if ($rowsOnLastPage == 0) {
		$totalPagesToDisplay = floor(($totalRowsToDisplay / $maxRowsPerPage));
	}
	else {
		$totalPagesToDisplay = (floor(($totalRowsToDisplay / $maxRowsPerPage)) + 1);
	}
}

// NOW display, for debugging purposes,
//              **********************
// the number of rows in the category and,
// the number of rows on the last page and,
// the number of pages to be displayed =8-)

//	echo 'Total Rows: (' . $totalRowsToDisplay . ') Rows on Last Page: (' . $rowsOnLastPage . ') Total Pages: (' . $totalPagesToDisplay . ') Category: (' . $category . ')<br />';

include 'library/closedb.php';
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=UTF-8" />
<title>Hometown - Orange County Direct Mail Advertising</title>
<meta http-equiv="Content-Language" content="en-us" />

<meta http-equiv="imagetoolbar" content="no" />
<meta name="MSSmartTagsPreventParsing" content="true" />

<meta name="description" content="Description" />
<meta name="keywords" content="Keywords" />

<meta name="author" content="Glen the Computer Guy for Hometown OC" />

<link href="p7exp/p7exp.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="p7exp/p7exp.js"></script>
<!--[if lte IE 7]>
	<style>
	#menuwrapper, #p7menubar ul a {height: 1%;}
	a:active {width: auto;}
	</style>
<![endif]-->

<style type="text/css" media="all">@import "css/masterNEW.css";</style>
<script type="text/javascript" src="p7pm/p7popmenu.js"></script>
<style type="text/css" media="screen">
	<!--
	@import url("p7pm/p7pmv0.css");
	.ltPurpleWhiteBG, a.ltPurpleLinksWhiteBG { background-color: #CC3366; color: #000000; }
	#ltPurpleWhiteBG li a { background-color: #CC3366; color: #000000; }
	#ltPurpleWhiteBG li a:hover { background-color: #FFFFFF; color: #000000; }
	-->
</style>
</head>

<body onLoad="P7_initPM(0,0,1,-20,10);P7_ExpMenu()">

<?php include("_preHeaderSplash.html"); ?>

<div id="page-container">

 

Now, please be gentle with me, Ken (et al who reply) ...

 

thanks a MILLION!!!

 

still-"stumped" Glen the Computer Guy

 

(edited by kenrbnsn to replace the [pre][/pre] tags with


tags)

 

I notice you have three files being included library/confg.php and library/opendb.php and library/closedb.php you don't by chance have the doctype etc defined in those files do you? If you do, then you dont need to define in those files.

 

You only need to define the doctype in the file that generates the page shown to the browser.

 

 

Oh, Wildteen88 ...  :D  ::)

 

That was EXACTLY what it was! I forgot that I had the doctype (and head, html, body) entries in those files!!!!!!!!!!!!!!

 

Thank you so much for your time and reply, Wildteen88!

 

Take care,

 

(no longer) "stumped" Glen the Computer Guy

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.