Page 1 of 1

[SOLVED] Placing Text : Not echo'ing where it should

Posted: Wed Jun 01, 2005 11:29 pm
by facets
Hi all,

I have the following code but I can't get it to echo the Title in the correct spot.
It displays at the top of the page. Any ideas why?

TIA, Wil

Code: Select all

for($x = 0; $x<count($forth); $x++) {
	echo "<tr><td width=\"200px\" colspan=\"2\" valign=\"top\">".$forth[$x]."</td>\n";
	echo "<td width=\"200px\" colspan=\"2\"><input type=\"text\" name=\"".$forthTitles[$x]."\" SIZE=\"20\"></td></tr>\n";
	}	

$fifth=array('Foil','Yellow Light','Neck Labels','Opacity');
$fifthTitles = array(foil(),bronze(),yellowLight(),screen(),neckLabel(),iceBucket(),opacity());
	
echo "<div class=subTitle>Suitability</div>";

for($x = 0; $x<count($fifth); $x++) {
	echo "<tr><td width=\"100px\" colspan=\"2\" valign=\"top\">".$fifth[$x]."</td>\n";
	echo "<td width=\"100px\">$fifthTitles[$x]</td></tr>\n";
	}	
echo "<input type=\"reset\" class=\"btn\" value=\"Reset Summary\">";
echo "<input type=\"submit\" name=\"submit\" class=\"btn\" value=\"addSummary\">";

Posted: Wed Jun 01, 2005 11:41 pm
by Skara
you don't have any opening or closing table tags. -_-'

Posted: Thu Jun 02, 2005 12:03 am
by facets
I'm unsure what you mean.
But if your refering to <? & ?> Tags, they are there.
The script is 400 Lines long. I didn't want to print it all :)

Posted: Thu Jun 02, 2005 2:04 am
by malcolmboston
what hes saying is.. do you have <table> and </table> present in your code?

Posted: Thu Jun 02, 2005 2:41 am
by malcolmboston
example...

Code: Select all

if (count($forth >= 1))
{
print "<table>";
}
for($x = 0; $x<count($forth); $x++)
{
echo "<tr><td width=\"200px\" colspan=\"2\" valign=\"top\">".$forth[$x]."</td>\n";
echo "<td width=\"200px\" colspan=\"2\"><input type=\"text\" name=\"".$forthTitles[$x]."\" SIZE=\"20\"></td></tr>\n";
}
print "</table>";
theres a glaring problem with my code (do you know what it is?) but the fundamentals are the same, make sure you print <table> and </table> before the FOR loop, making sure that <TR> and </TR> are called at the appropriate times.

Posted: Thu Jun 02, 2005 7:17 pm
by facets
Thanks for the replies guys.
It was a stupid HTML error.
ie, You can't put a DIV tag in-between like so </tr><div><tr>

Problem solved Thanks!