drop down button

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

ekosoftco
Forum Contributor
Posts: 108
Joined: Fri Aug 04, 2006 8:21 pm

Post by ekosoftco »

ok this is what ive got so far, but no results still. Ive been trying at this for 3 days now, :(

Code: Select all

if($_GET['action'] == 'editmember')
{
        // start the table, make headers 
        echo '<table class="style3"><tr><th>Username</th><th>Character Name</th><th>Option</th></tr>'; 
        
        // fetch results from the DB 
        $result = mysql_query("SELECT * FROM loginphp WHERE Guild='{$_SESSION['Guild']}'") or die(mysql_error()); 
        
        // print each row 
        while($row=mysql_fetch_assoc($result)){ 
                echo '<tr style="background:#8ab4ff;">'; 
                echo '<td>'.$row['Uname'].'</td>'; 
                echo '<td>'.$row['Cname1'].'</td>'; 
			 	echo '<td><FORM name=guidelinks method=post> 
				<SELECT name="guidelinks" ><OPTION SELECTED value="choose">--Choose--<OPTION name="makeadmin" value="makeadmin">Admin <OPTION name="makerecruiter" value="makerecruiter">Recruiter <OPTION name="deletemember" value="deletemember">Delete Member</SELECT>'; 
                echo '<td><input type=submit value=Edit></td></FORM>'; 
                echo '</tr>'; 

        } 
        // close the table 
        echo '</table>'; 
}
if ($_POST["choice"] == "makeadmin") 
	{ 
  	$result = mysql_query("UPDATE guilds SET Admin='{$_SESSION['Uname']}' WHERE Tag = '{$_SESSION['Guild']}'") or die(mysql_error());
	}
ive tried everything i could think of, doing an if(action = option name), if (post = option) and nothings worked so far
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

what does var_dump($_GET,$_POST) show?
ekosoftco
Forum Contributor
Posts: 108
Joined: Fri Aug 04, 2006 8:21 pm

Post by ekosoftco »

ok, i tried a little different code, but no results still... its not updating in the table

Code: Select all

if($_GET['action'] == 'editmember')
{
        // start the table, make headers 
        echo '<table class="style3"><tr><th>Username</th><th>Character Name</th><th>Option</th><th></th></tr>'; 
        
        // fetch results from the DB 
        $result = mysql_query("SELECT * FROM loginphp WHERE Guild='{$_SESSION['Guild']}'") or die(mysql_error()); 
        
        // print each row 
        while($row=mysql_fetch_assoc($result)){ 
                echo '<tr style="background:#8ab4ff;">'; 
                echo '<td>'.$row['Uname'].'</td>'; 
                echo '<td>'.$row['Cname1'].'</td>'; 
			 	echo '<td>';
echo "<form name=jump>";
echo "<select name=menu>";
echo "<option value=?action=makeadmin>Make Admin</option>";
echo "<option value=?action=makerecruiter>Make Recruiter</option>
<option value=?actiondeletemember>Delete Member</option>
</select></td><td>
<input type=button onClick=location=document.jump.menu.options[document.jump.menu.selectedIndex].value; value=Edit>
</form>";
                echo '</td></tr>'; 

        } 
        // close the table 
        echo '</table>'; 
}
if($_GET['action'] == 'makeadmin')
	{
  	$result = mysql_query("UPDATE loginphp SET Rank= 'Admin' WHERE Guild = '{$_SESSION['Guild']}'") or die(mysql_error());
	}
ekosoftco
Forum Contributor
Posts: 108
Joined: Fri Aug 04, 2006 8:21 pm

Post by ekosoftco »

I also have the code used for the buttons and the $_GET action on another page, to go to different actions so it will say different things when you select them, and it works fine, so i have no clue what the problem is for this one. x_X
Post Reply