Cod: Selectaţi tot
<?php
if (empty($_POST) === false) {
else // Altfel, daca totul s-a efectuat cu succes, se executa codul
{
// Facem update la user-ul respectiv schimbandu-i numarul de avertizari
mysql_query("UPDATE `utilizatori` SET `avertizari` = `avertizari` + NUMAR PUNCTE, `motiv_avertizare` = MOTIVUL' WHERE `username` = '". $_POST['username'] ."'");
<div class="alert alert-success">
<strong>Succes!</strong> Utilizatorul a fost avertizat! Motivul: MOTIV
</div>';
exit();
}
?>
<li>
<label class="control-label col-sm-2">Motiv:</label>
<?php
$con = mysqli_connect("localhost", "root", "", "db");
$sql = "SELECT * FROM `motive avertizari`";
if($result = mysqli_query($con, $sql)) {
if(mysqli_num_rows($result) > 0) {
echo '
<div class="col-sm-4">
<select class="form-control" required>
<option value="" >Alege motivul..</option>';
while($row = mysqli_fetch_array($result)) {
echo "
<option>" . $row['motiv'] . " (" . $row['puncte'] ." puncte)</option>";
}
echo "
</select>
</div>";
// Close result set
mysqli_free_result($result);
}
}
?>
</li>
<li>
<input type="submit" class="btn btn-default" value="Avertizeaza">
</li>