The solution (thanks to Bloodrun) is below.
The Original Post:
PHP:
<p>
<select name='owned_adoptables' id='owned_adoptables'>";
// We need to stop here and fetch their adoptables...
$query = "SELECT * FROM ".$prefix."owned_adoptables WHERE owner='$loggedinname'";
$result = mysql_query($query);
$num = mysql_numrows($result);
//Loop out code
$i=0;
while ($i < $num) {
$aid=@mysql_result($result,$i,"aid");
$currentlevel=@mysql_result($result,$i,"currentlevel");
$name=@mysql_result($result,$i,"name");
$article_content = $article_content."<option value='".$aid."'>".$name." :: ".$currentlevel."</option>";
$i++;
}
$article_content = $article_content."</select>
</p><br />
The Original Post:
I want users to easily be able to jump from one adoptable to another when managing, viewing stats, getting codes, renaming, freezing, unfreezing and killing adoptables.
So on each of the myadopt.php action pages I would like to have a drop-down menu that lists all of the user's existing adoptables. For example, if the user is on the rename page for their first adoptable (myadopts.php?act=rename&id=1), then they could rename adoptable 1, and then choose adoptable 2 from the drop-down menu allowing them to jump to the adoptable 2's rename page (myadopts.php?act=rename&id=2).
I understand that the code below doesn't currently allow navigation. I am just trying to get the pages to list the adoptables the user owns first. It doesn't seem to be showing up and I believe it may be conflicting with some of the other code on the myadopt.php action pages.
This is what I wanted to use:
PHP:$article_title = "Example Title"; $article_content = "Example Text"; //Get Member's adoptables from the database and display them $query = "SELECT * FROM ".$prefix."owned_adoptables WHERE owner='$loggedinname'"; $result = mysql_query($query); $num = mysql_numrows($result); //Member has 1 or more adoptable if($num > 0){ $dropdownstart = "<select>"; $dropdownend = "</select>"; } //Member has 0 adoptables else{ $dropdownstart = ""; $dropdownend = ""; } $article_content = $article_content."".$dropdownstart; //Loop out code $i=0; while ($i < $num) { $aid=@mysql_result($result,$i,"aid"); //The adoptable's ID $currentlevel=@mysql_result($result,$i,"currentlevel"); $type=@mysql_result($result,$i,"type"); $name=@mysql_result($result,$i,"name"); $owner=@mysql_result($result,$i,"owner"); $article_content = $article_content."<option value='".$aid."'>".$name."</option>"; $i++; } $article_content = $article_content."".$dropdownend;
Where would I put this so it will show up, for example, on the rename page and not conflict with the rename action code? Once I know how it will work for one of the action pages I can figure out the other ones.