Chezshire Posted July 30, 2008 Share Posted July 30, 2008 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"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/117267-solved-display-issue-final-entry-is-blank/ Share on other sites More sharing options...
pocobueno1388 Posted July 30, 2008 Share Posted July 30, 2008 $ethnicity[$ethnicity] Are those supposed to be two different variables? If so, then one of them is probably overriding the other. It's hard to really say much more without seeing more code. Quote Link to comment https://forums.phpfreaks.com/topic/117267-solved-display-issue-final-entry-is-blank/#findComment-603235 Share on other sites More sharing options...
Chezshire Posted July 30, 2008 Author Share Posted July 30, 2008 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 ?> Quote Link to comment https://forums.phpfreaks.com/topic/117267-solved-display-issue-final-entry-is-blank/#findComment-603239 Share on other sites More sharing options...
pocobueno1388 Posted July 30, 2008 Share Posted July 30, 2008 It's not that they are "similarly named", they ARE the same. Try changing that and see if it works. Quote Link to comment https://forums.phpfreaks.com/topic/117267-solved-display-issue-final-entry-is-blank/#findComment-603253 Share on other sites More sharing options...
Chezshire Posted July 30, 2008 Author Share Posted July 30, 2008 Thank you I feel so dumb. I listed it twice - thanks -- I need sleep. thank you thank you thank you! Chez Quote Link to comment https://forums.phpfreaks.com/topic/117267-solved-display-issue-final-entry-is-blank/#findComment-603279 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.