Jump to content

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
?>

 

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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