hello guys, i'm stuck with some code and i'm getting frustrated that i cannot get it work. Please help :))
I have a database with some details about registered users with a column named Activated (which is 0 or 1). I want to make a page were restricted users can modify this status (Activated) using checkboxes.
<?php
$con = mysql_connect("localhost","root","password");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("silvermountain", $con);
$result = mysql_query("SELECT * FROM brokeri");
echo "<form method='post' action='activate_account.php'>";
echo "<table border='0' width='100%' class='tabel_administrator' cellspacing='0'>
<tr>
<th>Nume</th>
<th>Prenume</th>
<th>Companie</th>
<th>Adresa companie</th>
<th>Nr Tel</th>
<th>Ap vandute</th>
<th>Ap reservate</th>
<th>Activat</th>
</tr>";
$a=0;
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['nume'] . "</td>";
echo "<td>" . $row['prenume'] . "</td>";
echo "<td>" . $row['companie'] . "</td>";
echo "<td>" . $row['adresa_companie'] . "</td>";
echo "<td>" . $row['nr_tel'] . "</td>";
echo "<td>" . $row['apartamente_vandute'] . "</td>";
echo "<td>" . $row['apartamente_rezervate'] . "</td>";
if($row['activat'] == 1) echo "<td>Activated</td>";
else {
echo "<td><input type='checkbox' name='to_activate[]' value=". $id[$a] ."></td>";
$a++;
}
echo "</tr>";
}
echo "</table> <input type='submit' name='submit' id='submit' value='Update'/></form></br>";
mysql_close($con);
?>
but now i don't know what to write in "activate_account.php" so that i modify only the users that were checked.