Hi guys!
I am creating the admin panel and now i want to make an area where admin can delete users from a drop list.
The promblem is that i cannot get the name of the user from the list when the admin highlights it.
Let me give you the code
<?php
mysql_connect("localhost");
mysql_select_db("authentication");
$result=mysql_query("SELECT username FROM users ORDER BY username");
echo "<table height=100% width=100% border=1>
<tr> <td align=center valign=center>
<form method=post action=$PHP_SELF>
<select name=users>
<option value=none>";
while($row=mysql_fetch_array($result)) {if($row[username]!='admin') {
echo "<option value=$row[username]>$row[username]";$user=$row[username]; }}
echo "</select>
<input type=submit value=Delete name=delete>
</form>
</td></tr>
</table>";
if($_POST[submit]) {
echo $_POST[user];
if($_POST[user]) {
mysql_query("DELETE FROM users WHERE username=$_POST[user]");
echo "<center> Successfully Deleted $_POST[user]</center>";
echo "<meta http-equiv='refresh' content='3'>";}
else {echo "<center>Nobody was inserted for deletion</center>";
echo "<meta http-equiv='refresh' content='3'>";}}
mysql_close(); ?>
How can i get the value of the option which was selected by the admin in order to be able to delete it with a simple query?
I want your help!!