homepage Welcome to WebmasterWorld Guest from 54.197.183.230
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / HTML
Forum Library, Charter, Moderators: incrediBILL

HTML Forum

    
Table CheckBox causes Blank Lines
Top of page gets a blank line for every row in MYSQL table
NetSavyGuy



 
Msg#: 4258685 posted 11:00 pm on Jan 26, 2011 (gmt 0)

WORDPRESS, PHP page displays MYSQL data from rows with pagination.
IE 8 displays table without blank lines top of page. Firefox displays blank lines on the top of the page. REMOVING THE CHECKBOX removes the BLANK Lines on TOP OF PAGE.

GURUS plz take a look....

COde IS Below

// $thispage = $_SERVER['PHP_SELF']; //Have to do this for heredoc
$thispage = "http://www.example.com/myadmi/research/display-all-picks";
$numresults=mysql_query($query1);
$numrows=mysql_num_rows($numresults);
PRINT("<html>");
PRINT("<head>");
PRINT(" <meta http-equiv='Content-Type' content='text/html; charset=utf-8'>");
PRINT(" <title>My Horse Handicapper Race Picks</title>");
PRINT(" <link rel='stylesheet' type='text/css' href='screen.css'>");
PRINT("<STYLE>
h1, h2, h3, h4, h5 {font-family: Arial, 'Lucida Sans Unicode','Lucida Grande',Garuda,sans-serif; font-weight: bold; color: #222; margin: 0; padding: 0; margin-top:0}
body > h1,h2,h3,h4,h5 {margin-top:0; background: #ff0;}
td > p {margin-top:0; background: #ff0;}
.body {
margin-top: 0px!important;
}
.form.showtab {
margin-top: 0px!important;
margin-left: 0px;
}
form.showtab {
margin-top: 0px!important;
margin-left: 0px;
}
.showtab {
margin-top: 0px!important;
margin-left: 0px;
}
showtab {
margin-top: 0px!important;
margin-left: 0px;
}
</STYLE>");
PRINT("</head>");
PRINT("<BODY>");
PRINT("<STYLE>
h1, h2, h3, h4, h5 {font-family: Arial, 'Lucida Sans Unicode','Lucida Grande',Garuda,sans-serif; font-weight: bold; color: #222; margin: 0; padding: 0; margin-top:0}
body > h1,h2,h3,h4,h5 {margin-top:0; background: #ff0;}
td > p {margin-top:0; background: #ff0;}
.body {
margin-top: 0px!important;
}
.form.showtab {
margin-top: 0px!important;
margin-left: 0px;
}
form.showtab {
margin-top: 0px!important;
margin-left: 0px;
}
.showtab {
margin-top: 0px!important;
margin-left: 0px;
}
showtab {
margin-top: 0px!important;
margin-left: 0px;
}
</STYLE>");
PRINT("<TABLE BORDER=16 BGCOLOR=beige>\n");
PRINT("<TR>");
PRINT("<TD><p><form name='showtab' method='post' action=''></TD></p></TR>" );
PRINT("<TR ALIGN=LEFT VALIGN=TOP>");
PRINT("<td colspan='11' align='center' bgcolor='#FFFFFF'>
<input name='View' type='submit' id='View' value='View'>
<input name='search' type='submit' id='search' value='search'>
<input name='racedatesearch' type='text' id='racedatesearch' value='racedate'>
<input name='racetracksearch' type='text' id='racetracksearch' value='racetrack'> </td>");
PRINT("</TR>");
PRINT("<TR BGCOLOR=#ffcc00><TH>Sel</TH><TH> RACE DATE </TH><TH> RACE TRACK </TH><TH> RACE </TH><TH> Pick 1 </TH><TH> Win 1</TH><TH> Pick 2 </TH><TH> Win 2</TH><TH> Pick 3 </TH><TH> Win 3</TH><TH> Pick 4 </TH><TH> Win 4</TH><TH> Pick 5 </TH><TH> Win 5</TH></TR>");
/* LOOP THRU TABLE */
while ($result1_row = mysql_fetch_row($result1))
{
$appkey = $result1_row[0];
$rowid = $result1_row[0];
$racedate = $result1_row;
$racetrack = $result1_row[2];
$race = $result1_row[3];
$pick1 = $result1_row[4];
$pick1win = $result1_row[5];
$pick2 = $result1_row[6];
$pick2win = $result1_row[7];
$pick3 = $result1_row[8];
$pick3win = $result1_row[9];
$pick4 = $result1_row[10];
$pick4win = $result1_row[11];
$pick5 = $result1_row[12];
$pick5win = $result1_row[13];

if ( $racetrack == "Tampa Bay Downs" ) { $racetrack = "Tampa" ; }
if ( $racetrack == "Churchill Downs" ) { $racetrack = "Churchill" ; }
if ( $racetrack == "Santa Anita" ) { $racetrack = "Santa Anita" ; }
print("<TR ALIGN=LEFT VALIGN=TOP>");
print("<TD align='left' bgcolor='#FFFFFF'><input name='checkbox[]' type='checkbox' id='checkbox[]' value='$result1_row[0]' unchecked</td>");
print("<TD><p><FONT color='green' >$racedate</FONT></p></TD>");
print("<TD><p><FONT color='green' >$racetrack</FONT></p></TD>");
print("<TD><p><FONT color='green' >$race</FONT></p></TD>");
print("<TD><p><FONT color='green' >$pick1</FONT></p></TD>");
print("<TD><p><FONT color='green' >$pick1win</FONT></p></TD>");
print("<TD><p><FONT color='green' >$pick2</FONT></p></TD>");
print("<TD><p><FONT color='green' >$pick2win</FONT></p></TD>");
print("<TD><p><FONT color='green' >$pick3</FONT></p></TD>");
print("<TD><p><FONT color='green' >$pick3win</FONT></p></TD>");
print("<TD><p><FONT color='green' >$pick4</FONT></p></TD>");
print("<TD><p><FONT color='green' >$pick4win</FONT></p></TD>");
print("<TD><p><FONT color='green' >$pick5</FONT></p></TD>");
print("<TD><p><FONT color='green' >$pick5win</FONT></p></TD>");
print("</TR>");
}
print("</TABLE>");
print("</BODY");

[1][edited by: tedster at 4:07 pm (utc) on Feb 18, 2011]
[edit reason] switch to example.com [/edit]

 

rocknbil

WebmasterWorld Senior Member rocknbil us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 4258685 posted 5:53 pm on Jan 28, 2011 (gmt 0)

Short answer: I don't know why removing the checkbox is the definitive fix, but the overall problem is most likely you are rendering in quirks mode.

PRINT("<html>");

No doctype = quirks mode (see links below.)

You might try changing this
print("</BODY");

to this

print("</BODY></html>");

Whether that will help or not, not sure, but it will complete the document.

Quirks Mode vs. Standards Compliance Mode [webmasterworld.com]
Choosing the best doctype for your site [webmasterworld.com]
W3 Validator [validator.w3.org]

Get through those three and the problem will likely go away.

NetSavyGuy



 
Msg#: 4258685 posted 1:28 am on Jan 29, 2011 (gmt 0)

My Final Fix Was to examine the browser type and position the table
on the page based on the browser type and number of rows in the table
I was displaying.

SAFARI, FIREFIX and IE are perfect so far.

I used the Following command in PHP to get the browser type
Interrogated the results

$u_agent = $_SERVER['HTTP_USER_AGENT'];

Based in the browser type I used the following commands to determine
table display line number relative to the page .

$where = $numrows * 15;
$tpos = "-"."$where"."px";
echo "<h3>Your Exotic Picks For $mydate have been posted </h3>";
//*************************************************************
//** Depending on Browser Type Adjust table position on page *
//*************************************************************

if ($ie == "y")
{
PRINT("<TABLE BORDER=8 BGCOLOR=beige>\n");
}
else
{
PRINT("<TABLE BORDER=8 BGCOLOR=beige style='position: relative; top: $tpos;>\n");
}

[edited by: tedster at 7:00 pm (utc) on Feb 18, 2011]

rocknbil

WebmasterWorld Senior Member rocknbil us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 4258685 posted 9:02 pm on Jan 30, 2011 (gmt 0)

Well, it you're happy with it, that's fine, but outputting based on browser identification is a never ending goose chase as browsers, versions, and operating systems vary and will continue to do so ad infinitum. What you wind up with is patch upon patch, tons of code to address this browser or that, some of which may exist for browsers that aren't even used any more - I still see a great deal of code out there for Netscape and IE4.

When you get a chance, look over the links I posted, the validator shows 600 errors on that page alone. Get it into Standards Compliance Mode and validated and you likely won't need to do all that.

g1smd

WebmasterWorld Senior Member g1smd us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 4258685 posted 9:10 pm on Jan 30, 2011 (gmt 0)

You should do all your database stuff and looping through storing data in variables BEFORE you send the DOCTYPE and HTML page.

This allows you to instead send alternative HTTP status codes before sending any content.

Once you have sent the DOCTYPE, the remaining PHP code should merely be ECHO and PRINT statements, not any logic dealing with fetching or manipulating data.

NetSavyGuy



 
Msg#: 4258685 posted 9:17 pm on Feb 5, 2011 (gmt 0)

Much of which is controlled by wordpress. It is generating <p> tags as I do not have any in the code. Most of the errors that the validator shows do not exist, or I cannot figure them out. The Actual source seems clean and all of the code works well, but now that the checkbox works, and the table lineup is right, None of the page buttons work in safari/mozilla.
I am happy to tell people to not use other browsers, as it would take me 9 months to get all the code up to snuff, if in fact that is even possible.
I will search the wordpress forums to see if their is any hope there, otherwise its IE or nada...

Fotiman

WebmasterWorld Senior Member fotiman us a WebmasterWorld Top Contributor of All Time 5+ Year Member



 
Msg#: 4258685 posted 10:27 pm on Feb 5, 2011 (gmt 0)


PRINT("<TD><p><form name='showtab' method='post' action=''></TD></p></TR>" );

This will cause a blank line, and is invalid. You should really clean up your markup or you'll be facing maintenance nightmare. Move the form tags to surround your table tags instead of trying to stick them in a table cell.

Also, you've got styles being printed twice, once in the head and once in the body (which is also NOT where styles belong). Remove the extra from the body.

NetSavyGuy



 
Msg#: 4258685 posted 1:19 pm on Feb 18, 2011 (gmt 0)

The Correct FIX has finally been applied. Wordpress was causing all the errors.

The Fix Was to place the following code in functions.php of the theme
I was using.

remove_filter( 'the_content', 'wpautop' );
remove_filter( 'the_excerpt', 'wpautop' );


This stopped all of the <p> tags from being generated, and my problem and all its sypmtoms have been corrected.

I wanted to thank you all for your attempts to help me, and to finally share with you the correct fix I used in the end.

My Prior fix actually worked, but it disabled the SUBMIT button which forced me to find the proper fix.

"Necessity, The Mother Of Invention" !

Thanks again
Tom Westervelt

[edited by: tedster at 4:05 pm (utc) on Feb 18, 2011]
[edit reason] remove the extended signature [/edit]

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / HTML
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved