jaydeesmalls Posted April 30, 2008 Share Posted April 30, 2008 I know it's a lot, and probably, not very pretty, and there probably is a better way to do this, but... Why doesn't the 'act' field show when I try to echo this? Every other field shows fine, just the 'act' field. <?php $id ='11'; //Foundation Specialist 1 $results = mysql_query("SELECT p1 FROM $tbl_name WHERE id='$id'"); $values = mysql_fetch_array($results); ?> <select name="fs1a"> <option value=" "<?php if ($values['p1'] == " ") echo 'selected="selected"'; ?>> </option> <option value="Annie"<?php if ($values['p1'] == "Annie") echo 'selected="selected"'; ?>>Annie</option> <option value="Antonio"<?php if ($values['p1'] == "Antonio") echo 'selected="selected"'; ?>>Antonio</option> <option value="Beverly"<?php if ($values['p1'] == "Beverly") echo 'selected="selected"'; ?>>Beverly</option> <option value="Celia"<?php if ($values['p1'] == "Celia") echo 'selected="selected"'; ?>>Celia</option> <option value="Charlene"<?php if ($values['p1'] == "Charlene") echo 'selected="selected"'; ?>>Charlene</option> <option value="Dennis"<?php if ($values['p1'] == "Dennis") echo 'selected="selected"'; ?>>Dennis</option> <option value="Elaine"<?php if ($values['p1'] == "Elaine") echo 'selected="selected"'; ?>>Elaine</option> <option value="Elizabeth"<?php if ($values['p1'] == "Elizabeth") echo 'selected="selected"'; ?>>Elizabeth</option> <option value="Erica"<?php if ($values['p1'] == "Erica") echo 'selected="selected"'; ?>>Erica</option> <option value="Faye"<?php if ($values['p1'] == "Faye") echo 'selected="selected"'; ?>>Faye</option> <option value="Gladys"<?php if ($values['p1'] == "Gladys") echo 'selected="selected"'; ?>>Gladys</option> <option value="Grace"<?php if ($values['p1'] == "Grace") echo 'selected="selected"'; ?>>Grace</option> <option value="Jennifer"<?php if ($values['p1'] == "Jennifer") echo 'selected="selected"'; ?>>Jennifer</option> <option value="Karl"<?php if ($values['p1'] == "Karl") echo 'selected="selected"'; ?>>Karl</option> <option value="Kimberly"<?php if ($values['p1'] == "Kimberly") echo 'selected="selected"'; ?>>Kimberly</option> <option value="Ross"<?php if ($values['p1'] == "Ross") echo 'selected="selected"'; ?>>Ross</option> <option value="Seth"<?php if ($values['p1'] == "Seth") echo 'selected="selected"'; ?>>Seth</option> <option value="Shana"<?php if ($values['p1'] == "Shana") echo 'selected="selected"'; ?>>Shana</option> </select> <?php $id ='11'; //Foundation Specialist 1 $results = mysql_query("SELECT act FROM $tbl_name WHERE id='$id'"); $values = mysql_fetch_array($results); ?> <select name="act"> <option value=" "<?php if ($values['act'] == " ") echo 'selected="selected"'; ?>> </option> <option value="©"<?php if ($values['act'] == "©") echo 'selected="selected"'; ?>>©</option> <option value="(H)"<?php if ($values['act'] == "(H)") echo 'selected="selected"'; ?>>(H)</option> <option value="(T)"<?php if ($values['act'] == "(T)") echo 'selected="selected"'; ?>>(T)</option> </select> <?php $id ='11'; //Foundation Specialist 1 $results = mysql_query("SELECT p2 FROM $tbl_name WHERE id='$id'"); $values = mysql_fetch_array($results); ?> <select name="fs1b"> <option value=" "<?php if ($values['p2'] == " ") echo 'selected="selected"'; ?>> </option> <option value="Annie"<?php if ($values['p2'] == "Annie") echo 'selected="selected"'; ?>>Annie</option> <option value="Antonio"<?php if ($values['p2'] == "Antonio") echo 'selected="selected"'; ?>>Antonio</option> <option value="Beverly"<?php if ($values['p2'] == "Beverly") echo 'selected="selected"'; ?>>Beverly</option> <option value="Celia"<?php if ($values['p2'] == "Celia") echo 'selected="selected"'; ?>>Celia</option> <option value="Charlene"<?php if ($values['p2'] == "Charlene") echo 'selected="selected"'; ?>>Charlene</option> <option value="Dennis"<?php if ($values['p2'] == "Dennis") echo 'selected="selected"'; ?>>Dennis</option> <option value="Elaine"<?php if ($values['p2'] == "Elaine") echo 'selected="selected"'; ?>>Elaine</option> <option value="Elizabeth"<?php if ($values['p2'] == "Elizabeth") echo 'selected="selected"'; ?>>Elizabeth</option> <option value="Erica"<?php if ($values['p2'] == "Erica") echo 'selected="selected"'; ?>>Erica</option> <option value="Faye"<?php if ($values['p2'] == "Faye") echo 'selected="selected"'; ?>>Faye</option> <option value="Gladys"<?php if ($values['p2'] == "Gladys") echo 'selected="selected"'; ?>>Gladys</option> <option value="Grace"<?php if ($values['p2'] == "Grace") echo 'selected="selected"'; ?>>Grace</option> <option value="Jennifer"<?php if ($values['p2'] == "Jennifer") echo 'selected="selected"'; ?>>Jennifer</option> <option value="Karl"<?php if ($values['p2'] == "Karl") echo 'selected="selected"'; ?>>Karl</option> <option value="Kimberly"<?php if ($values['p2'] == "Kimberly") echo 'selected="selected"'; ?>>Kimberly</option> <option value="Ross"<?php if ($values['p2'] == "Ross") echo 'selected="selected"'; ?>>Ross</option> <option value="Seth"<?php if ($values['p2'] == "Seth") echo 'selected="selected"'; ?>>Seth</option> <option value="Shana"<?php if ($values['p2'] == "Shana") echo 'selected="selected"'; ?>>Shana</option> </select><br> <?php $id ='11'; //Foundation Specialist 1 Extra $results = mysql_query("SELECT extra FROM $tbl_name WHERE id='$id'"); $values = mysql_fetch_array($results); ?> <input type="text" name="fs1ex" size="15" maxlength="60" value="<?php echo $values['extra']; ?>"/><input type="hidden" name="textid" value="<?php echo $id; ?>" /> <?php $id ='11'; //Update 1 $results = mysql_query("SELECT up1 FROM $tbl_name WHERE id='$id'"); $values = mysql_fetch_array($results); ?> <input type="text" name="fs1up1" size="12" maxlength="60" value="<?php echo $values['up1']; ?>"/><input type="hidden" name="textid" value="<?php echo $id; ?>" /> <?php $id ='11'; //Update 2 $results = mysql_query("SELECT up2 FROM $tbl_name WHERE id='$id'"); $values = mysql_fetch_array($results); ?> <input type="text" name="fs1up2" size="12" maxlength="60" value="<?php echo $values['up2']; ?>"/><input type="hidden" name="textid" value="<?php echo $id; ?>" /> <?php $id ='11'; //Update 3 $results = mysql_query("SELECT up3 FROM $tbl_name WHERE id='$id'"); $values = mysql_fetch_array($results); ?> <input type="text" name="fs1up3" size="12" maxlength="60" value="<?php echo $values['up3']; ?>"/><input type="hidden" name="textid" value="<?php echo $id; ?>" /> <?php $id ='11'; //Update 4 $results = mysql_query("SELECT up4 FROM $tbl_name WHERE id='$id'"); $values = mysql_fetch_array($results); ?> <input type="text" name="fs1up4" size="12" maxlength="60" value="<?php echo $values['up4']; ?>"/><input type="hidden" name="textid" value="<?php echo $id; ?>" /> <?php $id ='11'; //Update 5 $results = mysql_query("SELECT up5 FROM $tbl_name WHERE id='$id'"); $values = mysql_fetch_array($results); ?> <input type="text" name="fs1up5" size="12" maxlength="60" value="<?php echo $values['up5']; ?>"/><input type="hidden" name="textid" value="<?php echo $id; ?>" /> <?php $id ='11'; //Update 6 $results = mysql_query("SELECT up6 FROM $tbl_name WHERE id='$id'"); $values = mysql_fetch_array($results); ?> <input type="text" name="fs1up6" size="12" maxlength="60" value="<?php echo $values['up6']; ?>"/><input type="hidden" name="textid" value="<?php echo $id; ?>" /> <?php $id ='11'; //Update 7 $results = mysql_query("SELECT up7 FROM $tbl_name WHERE id='$id'"); $values = mysql_fetch_array($results); ?> <input type="text" name="fs1up7" size="12" maxlength="60" value="<?php echo $values['up7']; ?>"/><input type="hidden" name="textid" value="<?php echo $id; ?>" /> and where is what I have on the page where it is to be echoed: <?php $query="SELECT * FROM $tbl_name WHERE id ='11'"; $result=mysql_query($query); while ($row = mysql_fetch_array($result)) { echo '<h2>', ($row['p1']), '</h2>' . ' ' . '<h2>', ($row['act']), '</h2>' . ' ' . '<h2>', ($row['p2']), '</h2>' . ' ' . '<h2>', '</h2>' . ' ' . '<h2>', ($row['extra']), '</h2>' . ' ' . '<h2 class="update1">', ($row['up1']), '</h2>' . ' ' . '<h2 class="update2">', ($row['up2']), '</h2>' . ' ' . '<h2 class="update3">', ($row['up3']), '</h2>' . ' ' . '<h2 class="update4">', ($row['up4']), '</h2>' . ' ' . '<h2 class="update5">', ($row['up5']), '</h2>' . ' ' . '<h2 class="update6">', ($row['up6']), '</h2>' . ' ' . '<h2 class="update7">', ($row['up7']), '</h2>'; } mysql_free_result($result); ?> Thank you for reading this Link to comment https://forums.phpfreaks.com/topic/103602-help-i-cant-figure-out-whats-wrong-with-this/ Share on other sites More sharing options...
hitman6003 Posted April 30, 2008 Share Posted April 30, 2008 What do you mean "it's not showing"? It's not displaying at all? The selected field isn't being preselected? Please elaborate. Link to comment https://forums.phpfreaks.com/topic/103602-help-i-cant-figure-out-whats-wrong-with-this/#findComment-530610 Share on other sites More sharing options...
jaydeesmalls Posted April 30, 2008 Author Share Posted April 30, 2008 When I echo the statement, only the 'act' portion is not printed. And I don't understand what I did wrong there. Thanks Link to comment https://forums.phpfreaks.com/topic/103602-help-i-cant-figure-out-whats-wrong-with-this/#findComment-530683 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.