Problem with Selecting Drop Down Menu option selections, I'm building a little Play-By-Post X-men based RPG for fun - and i |
Problem with Selecting Drop Down Menu option selections, I'm building a little Play-By-Post X-men based RPG for fun - and i |
chezshire |
Apr 12 2008, 12:59 AM
Post
#1
|
Group: Members Posts: 5 Joined: 12-April 08 Member No.: 5,423 |
Hello everyone,
this is my first time posting to a forum or asking for help (i'm very new and still learning what i'm doing and all that other stuff, so if i phopah, I hope you'll forgive me and help me to understand the correct way to do everything from asking for help to implementing any help given. I'm trying to tweak my little rpg site that my friends and anyone else who wishes is welcome to (www.xpg.us). I'm currently trying to add the ability for players to select facaulty advisors, Student Mentors and or Tutors to their character Bios. The problem i'm running into is that while they can select each - when I go to look at what's displayed, the value selected in the Faculty Advisor is displayed for all. Here is the code for the Edit character page: CODE <?php if ($moderator) { ?> <tr> <td width="30%" align="right" valign="top"><p>Faculty Advisor:</p></td> <td colspan="2" valign="top"><SELECT name="ADVISOR"> <option value=""> -- none -- </option> <?php $testy = mysql_query("SELECT id,codename from cerebra WHERE (type='faculty' OR type='administrator' or type='staff' or type='alumni') AND approved='true' ORDER BY codename"); WHILE ($advisor = mysql_fetch_assoc($testy)) { echo "<option value='" . $advisor["id"] . "'"; if ($record["advisor"] == $advisor["id"]) { echo " selected"; } echo ">" . $advisor["codename"] . "</option>\n"; } // end WHILE ?> <tr> <td width="30%" align="right" valign="top"><p>Student Mentor:</p></td> <td colspan="2" valign="top"><SELECT name="MENTOR"> <option value=""> -- none -- </option> <?php $testy = mysql_query("SELECT id,codename from cerebra WHERE (type='student') AND approved='true' ORDER BY codename"); WHILE ($mentor = mysql_fetch_assoc($testy)) { echo "<option value='" . $mentor["id"] . "'"; if ($record["mentor"] == $mentor["id"]) { echo " selected"; } echo ">" . $mentor["codename"] . "</option>\n"; } // end WHILE ?> <tr> <td width="30%" align="right" valign="top"><p>Assigned Tutor:</p></td> <td colspan="2" valign="top"><SELECT name="TUTOR"> <option value=""> -- none -- </option> <?php $testy = mysql_query("SELECT id,codename from cerebra WHERE ('alumni' OR type='administrator' OR 'faculty' OR type='staff' OR type='student') AND approved='true' ORDER BY codename"); WHILE ($tutor = mysql_fetch_assoc($testy)) { echo "<option value='" . $tutor["id"] . "'"; if ($record["tutor"] == $tutor["id"]) { echo " selected"; } echo ">" . $tutor["codename"] . "</option>\n"; } // end WHILE ?> </select> </td> </tr> <td width="30%" align="right" valign="top"><p>Room Assignment:</p></td> <td colspan="2" valign="top"><input type="text" name="ROOM" size="50" value="<?php echo $record["room"]; ?>"></td> </tr> <?php } // end if moderator } // end if record is student ?> </table> [code] Any help would be greatly appreciated. Thanks to one and all. -M |
Brian Chandler |
Apr 12 2008, 07:45 AM
Post
#2
|
Jocular coder Group: Members Posts: 2,460 Joined: 31-August 06 Member No.: 43 |
QUOTE Here is the code for the Edit character page: Can you try to isolate the problem? It is not reasonable to expect people to gaze at your program, then debug it their heads. |
chezshire |
Apr 12 2008, 10:48 AM
Post
#3
|
Group: Members Posts: 5 Joined: 12-April 08 Member No.: 5,423 |
Thank you Jocular -- I will try to do that in the future. I figured out the issue, and as it turns out it was in my the code above - that all works. The problem was in my display code for the page that displayed the results.
Thats said, i feel posting here was a very positive experience in that I've learned two things (a) that places like this exist (b) a little more about how to properly post when asking for help. I'm very very new to coding and trying to code and stuff like this. So any and all help is always appreciated. Thank you very much for your guidance which i shall apply in my posting! -M |
Lo-Fi Version | Time is now: 25th May 2024 - 06:26 PM |