The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Programming Languages
> PHP Development
|
Help - Ghost in the machine
Discuss Help - Ghost in the machine in the PHP Development forum on Dev Shed. Help - Ghost in the machine PHP Development forum discussing coding practices, tips on PHP, and other PHP-related topics. PHP is an open source scripting language that has taken the web development industry by storm.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

February 25th, 2013, 05:38 PM
|
|
Registered User
|
|
Join Date: Feb 2013
Posts: 5
Time spent in forums: 33 m 6 sec
Reputation Power: 0
|
|
|
Help - Ghost in the machine
Alright, here's the deal:
i wrote a couple of scripts and have them output HTML.
but it's ALSO outputting HTML that I DO NOT tell it to do.
i can't find the problem.
First the main .php :
Code:
<?php
include 'CheckLogin.php';
?>
<html>
<head>
<meta content="text/html; charset=ISO-8859-1" http-equiv="content-type">
<title>GetMiPi - Register</title>
</head>
<?php
include 'topmenu.php';
include 'startpielist.php';
//Connecting to your database
$Con = mysql_connect($hostnameCon, $usernameCon, $passwordCon);
mysql_select_db($dbnameCon);
$sql = mysql_query("SELECT * FROM PIES WHERE Owner = '$username'") or die(mysql_error());
while ($query_row = mysql_fetch_array($sql))
{
$pieID = $query_row['ID'];
$pieOwner = $query_row['Owner'];
$pieKind = $query_row['Kind'];
$pieBaked = $query_row['Baked'];
$pieCHEK = $query_row['CHEK'];
include 'PieList.php';
}
?>
The "topmenu.php" :
Code:
<?php
?>
<body
style="color: rgb(0, 0, 0); background-color: rgb(148, 164, 68);"
alink="#006600" link="#6666cc" vlink="#3366ff">
<big><big><big></big></big></big>
<div style="text-align: center;">
<table
style="text-align: center; margin-left: auto; margin-right: auto; background-color: rgb(255, 255, 204); width: 100%; height: 49px;"
border="4" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td
style="background-color: rgb(255, 255, 204); text-align: center; vertical-align: top;"><big><big><big><span
style="font-weight: bold;"><a
href="http://www.getmipi.com/FAQ.html">FAQ</a>
<a href="http://getmipi.com/forums/">FORUMS</a>
<a href="http://getmipi.com/Contact.html">CONTACT</a>
<a href="http://getmipi.com/Media/Media.html">MEDIA</a></span></big></big></big><br>
</td>
</tr>
</tbody>
</table>
</div>
next: "StartPieList.PHP"
Code:
<?php
// start pie table
?>
<------- start of pie list header ------>
<table style="width: 800px; height: 560px; text-align: left; margin-left: auto; margin-right: auto;" border="4"
cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="vertical-align: top; text-align: center; background-color: rgb(153, 153, 255);">
<div style="text-align: left;">
<br>
<table style="background-color: rgb(255, 255, 204); width: 700px; height: 131px; text-align: left; margin-left: auto;
margin-right: auto;" border="0" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="width: 50px; text-align: left; vertical-align: middle;">
</td>
<--- End of pie list header ---->
<?php
// end start of pie table
and now: "PieList.php"
Code:
<?php
?>
<--- Start Pie List --->
<table style="background-color: rgb(255, 255, 204); width: 700px; height: 131px; text-align: left; margin-left: auto;
margin-right: auto;" border="0" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="width: 50px; text-align: left; vertical-align: middle;">
<img style="width: 79px; height: 45px;" alt="" src="
<x=$pieimgx>
" hspace="10" align="middle"> </td>
<td>
<br><div style="text-align: center;"><big>
ID:<?=$pieID?>
<BR>
Owner:<?=$pieOwner?>
<BR>
Kind:<?=$pieKind?>
<BR>
Baked:<?=$pieBaked?>
<BR>
CHEK:<?=$pieCHEK?>
<BR>
</big> </div>
</td>
</tr>
</tbody>
</table>
<--- END Pie List --->
<BR>
<?php
?>
but here is the output (excerpting only the effected part):
Code:
<------- start of pie list header ------>
<table style="width: 800px; height: 560px; text-align: left; margin-left: auto; margin-right: auto;" border="4" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="vertical-align: top; text-align: center; background-color: rgb(153, 153, 255);">
<div style="text-align: left;">
<br>
<--- End of pie list header ---->
<--- Start Pie List --->
<table style="background-color: rgb(255, 255, 204); width: 700px; height: 131px; text-align: left; margin-left: auto; margin-right: auto;" border="0" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="width: 50px; text-align: left; vertical-align: middle;">
</td></tr></tbody></table><table style="background-color: rgb(255, 255, 204); width: 700px; height: 131px; text-align: left; margin-left: auto; margin-right: auto;" border="0" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="width: 50px; text-align: left; vertical-align: middle;">
<img style="width: 79px; height: 45px;" alt="" src="%0A%0A%3Cx=$pieimgx%3E%0A%0A" hspace="10" align="middle"> </td>
<td>
<br><div style="text-align: center;"><big>
ID:2
<br>
Owner:WaxyChicken
<br>
Kind:PIE
<br>
Baked:0000-00-00 00:00:00
<br>
CHEK:BLANK
<br>
</big> </div>
</td>
</tr>
</tbody>
</table>
<--- END Pie List --->
<br>
<--- Start Pie List --->
<table style="background-color: rgb(255, 255, 204); width: 700px; height: 131px; text-align: left; margin-left: auto; margin-right: auto;" border="0" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="width: 50px; text-align: left; vertical-align: middle;">
<img style="width: 79px; height: 45px;" alt="" src="%0A%0A%3Cx=$pieimgx%3E%0A%0A" hspace="10" align="middle"> </td>
<td>
<br><div style="text-align: center;"><big>
ID:3
<br>
Owner:WaxyChicken
<br>
Kind:CowPie
<br>
Baked:0000-00-00 00:00:00
<br>
CHEK:BLANK
<br>
</big> </div>
</td>
</tr>
</tbody>
</table>
<--- END Pie List --->
You will notice that the first "<--- Start Pie List --->" has extra close tags in it for table and a few other things. But i cannot find what it's coming from.
I have found that if i exclude the "StartPieList.php" then the problem is resolved, but that also removes the intended layout.
As for all the frekystuff ( playing with the ?> and <?php , adding in <----StartPieList etc....) i was seeing if that was the problem and was also trying to narrow down the cause. those 2 basic elements are not the cause of the problem.
|

February 25th, 2013, 05:40 PM
|
|
Registered User
|
|
Join Date: Feb 2013
Posts: 5
Time spent in forums: 33 m 6 sec
Reputation Power: 0
|
|
|
the screenshot isn't going through. Apparently bots are better at Capcha's than i am.
but a screenshot is available here:
img29.imageshack.us/img29/7857/ghostjd.png
|

February 26th, 2013, 03:31 PM
|
 |
Contributing User
|
|
Join Date: Oct 2009
Location: Jakarta, Indonesia.
|
|
One extra <?php near <--- End of pie list header ----> ?
If not, then try Notepadd++ softw. to find any missing pairs 
|

February 26th, 2013, 07:46 PM
|
|
Registered User
|
|
Join Date: Feb 2013
Posts: 5
Time spent in forums: 33 m 6 sec
Reputation Power: 0
|
|
Quote: | Originally Posted by hdewantara One extra <?php near <--- End of pie list header ----> ?
If not, then try Notepadd++ softw. to find any missing pairs  |
No. that was part of me trying different header/footers to find out if that could be effecting it.
and that doesn't explain where the automatically closing tags are coming from.
|

February 26th, 2013, 11:32 PM
|
|
Registered User
|
|
Join Date: Feb 2013
Posts: 5
Time spent in forums: 33 m 6 sec
Reputation Power: 0
|
|
.
does PHP ever automatically close HTML tags?
Quote: | I have found that if i exclude the "StartPieList.php" then the problem is resolved, but that also removes the intended layout. |
|

February 27th, 2013, 04:52 AM
|
|
|
Quote: | Originally Posted by WaxyChicken .
does PHP ever automatically close HTML tags? |
No. Browsers might.
__________________
I ♥ ManiacDan & requinix
This is a sig, and not necessarily a comment on the OP:
Please don't be a help vampire!
|

February 27th, 2013, 06:04 PM
|
|
Registered User
|
|
Join Date: Feb 2013
Posts: 5
Time spent in forums: 33 m 6 sec
Reputation Power: 0
|
|
Quote: | Originally Posted by ptr2void No. Browsers might. |
but i doubt that firefox would close tags before the page even finishes loading. 
|

February 28th, 2013, 08:17 AM
|
 |
Likely to be eaten by a grue.
|
|
Join Date: Oct 2006
Location: Pennsylvania, USA
|
|
Firefox does its best with bad HTML. This is bad HTML.
Code:
<img style="width: 79px; height: 45px;" alt="" src="
<x=$pieimgx>
" hspace="10" align="middle">
Why is your image source the string "<x=$pieimgx>" with 2 newlines on either side? Did you maybe mean for this to be a <?php ?> tag?
__________________
HEY! YOU! Read the New User Guide and Forum Rules
"They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin
"The greatest tragedy of this changing society is that people who never knew what it was like before will simply assume that this is the way things are supposed to be." -2600 Magazine, Fall 2002
Think we're being rude? Maybe you asked a bad question or you're a Help Vampire. Trying to argue intelligently? Please read this.
|

February 28th, 2013, 08:37 AM
|
|
|
|
* add a doctype
* move css to an external file
* replace deprecated elements
* use proper opening and closing tags
* switch to UTF-8
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|