I have this form on my site to change activated statuses of users in the users list, so the admin has the ability to ban people from the admin area. The form is meant to show what the activation status is, then show either 0, or 1 as an option. If you drop down and change to the opposite choice, it will change the activation status number in the database under the specific username in which you've changed the activation number. I am having a problem because when you change the number, the page refreshes as something is happening. But it seems to not send the information or change the database at all? Has anyone got any help here? Thanks.
$outputList .= '<tr><td>'. $id .'</td><td>'. $firstname .'</td>
<td>'. $lastname .'</td>
<td><form name="activationsend" action="admin.php?page=2" method="POST">
<input type="hidden"/>
<select name="act" onchange="this.form.submit();">
<option style="display:none">'. $activated .'</option>
<option name="0" value="0" >0</option>
<option name="1" value="1" >1</option>
</select>
</td>
<td><a href="'. $username .'">'. $username .'</a></td>
</form>
</tr>';
}
$outputList .= '</tbody>
</table>';
if (isset($_POST['activationsend'])){
$activated = $_POST['act'];
$username = $_POST['$username'];
$exists = mysql_query ("SELECT * FROM users WHERE username='$username'") or die ("not found");
if (mysql_num_rows($exists) != 0){
//update the info in database
mysql_query ("UPDATE users SET activated='$activated' WHERE username='$username'") or die ("update didn't work");
echo "worked";
} else echo "did not work";
}
$username = $_POST['$username'];also username is never posted, there's no such field