Jump to content

[SOLVED] Display Issue: Final entry is blank :(


Chezshire

Recommended Posts

Hi,

  I'm very vexed with my little piece of code below. I've checked my spelling, database, etc. to see if its a misspelt word or something and i don't think it is. I used the same initial code snippet each time and it works for displaying a characters height, weight, eye color and hair color. However the ethnicity is blank. Anyone have any idea as to what i might be doing wrong? Am i being like really dumb or what?

 

Thanks for any suggestions, guidance or help as always -- Everyone here rocks!

<?php
if ($height) 
{
echo "<tr><td align=\"right\" valign=\"top\"><p><b>HEIGHT:</b></p></td>\n";
echo "<td width=\"10\"> </td><td valign=\"top\"><p>" . $characterHeight[$height] . "</p></td></tr>\n"; 
}
if ($weight) 
{
echo "<tr><td align=\"right\" valign=\"top\"><p><b>HEIGHT:</b></p></td>\n";
echo "<td width=\"10\"> </td><td valign=\"top\"><p>" . $characterWeight[$weight] . "</p></td></tr>\n";
}
if ($eyes) 
{
echo "<tr><td align=\"right\" valign=\"top\"><p><b>EYE COLOR:</b></p></td>\n";
echo "<td width=\"10\"> </td><td valign=\"top\"><p>" . $eyeColor[$eyes] . "</p></td></tr>\n";
}
if ($hair) 
{
echo "<tr><td align=\"right\" valign=\"top\"><p><b>HAIR COLOR:</b></p></td>\n";
echo "<td width=\"10\"> </td><td valign=\"top\"><p>" . $hairColor[$hair] . "</p></td></tr>\n";
}
if ($ethnicity) 
{
echo "<tr><td align=\"right\" valign=\"top\"><p><b>ETHNICITY:</b></p></td>\n";
echo "<td width=\"20\"> </td><td valign=\"top\"><p>" . $ethnicity[$ethnicity] . "</p></td></tr>\n";
}
?>

 

 

This is how i was doing it and i was thinking that the problem might have been that the two variable were too similiarly named. This is how i was doing it (but i want pull downs now and moved to pull downs in the form where people enter text)

<?php
$theseFields = array("quote", "height", "weight", "hair", "eyes", "ethnicity", "characteristics", "dateofbirth", "age", "gender", "appearance", "modelname");
foreach ($theseFields as $thisField) {
if (${$thisField}) { echo "<tr><td align=\"right\" valign=\"top\"><p><b>" . ${$thisField . "Name"} . ":</b></p></td>\n";
echo "<td width=\"10\"> </td><td valign=\"top\"><p>" . ${$thisField} . "</p></td></tr>\n";
} // end if info
} // end FOREACH
if ($song) { echo "<tr><td align=\"right\" valign=\"top\"><p><b>THEME SONG:</b></p></td>\n";
echo "<td width=\"10\"> </td><td valign=\"top\"><p>" . $song;
if ($song_link) { echo "<br>" . $song_link; }
echo "</p></td></tr>\n";
} // end if song
if ($waiver) { echo "<tr><td align=\"right\" valign=\"top\"><p><b>WAIVER:</b></p></td>\n";
echo "<td width=\"10\"> </td><td valign=\"top\"><p>" . $waiver;
} // end if song
?>

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.