PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
facets
Forum Contributor
Posts: 273 Joined: Wed Apr 13, 2005 1:53 am
Location: Detroit
Post
by facets » Wed Jun 01, 2005 11:29 pm
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\">";
Last edited by
facets on Thu Jun 02, 2005 7:17 pm, edited 1 time in total.
Skara
Forum Regular
Posts: 703 Joined: Sat Mar 12, 2005 7:13 pm
Location: US
Post
by Skara » Wed Jun 01, 2005 11:41 pm
you don't have any opening or closing table tags. -_-'
facets
Forum Contributor
Posts: 273 Joined: Wed Apr 13, 2005 1:53 am
Location: Detroit
Post
by facets » Thu Jun 02, 2005 12:03 am
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
malcolmboston
DevNet Resident
Posts: 1826 Joined: Tue Nov 18, 2003 1:09 pm
Location: Middlesbrough, UK
Post
by malcolmboston » Thu Jun 02, 2005 2:04 am
what hes saying is.. do you have <table> and </table> present in your code?
malcolmboston
DevNet Resident
Posts: 1826 Joined: Tue Nov 18, 2003 1:09 pm
Location: Middlesbrough, UK
Post
by malcolmboston » Thu Jun 02, 2005 2:41 am
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.
facets
Forum Contributor
Posts: 273 Joined: Wed Apr 13, 2005 1:53 am
Location: Detroit
Post
by facets » Thu Jun 02, 2005 7:17 pm
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!