1
I am developing a page that will serve to edit the support calls : open, pending and solved. But before the fields I created in Mysql I cannot update to update what I want.
<form role="form" method="post">
<div class="col-sm-6">
<!-- select -->
<div class="form-group">
<label>Select</label>
<select class="form-control">
<option value="Em Aberto" name="status_chamado" id="status_chamado" id="status">Em Aberto</option>
<option value="Em Andamento" name="status_chamado" id="status_chamado" id="status">Em Andamento</option>
<option value="Resolvido" name="status_chamado" id="status_chamado" id="status">Resolvido</option>
</select>
<button type="submit" name="botao" class="col-md-12 btn btn-success">ATUALIZAR</button>
</div>
</div>
</form>
It must update the "status_called" field of the "called" table that already has the value "Open" when the call is created, without changing the other values.
I tried using PHP concatenation but I got lost all over...
<?php
if(isset($_POST['botao'])) {
$status_chamado = $_POST['status_chamado'];
$cadastro = "UPDATE chamados SET status_chamado = ' " . $status_chamado . " ' WHERE id_chamado = " . $id_chamado ;
try{
$result = $conect->prepare($cadastro);
$result->bindParam(':status_chamado',$status_chamado,PDO::PARAM_STR);
$result->execute();
$contar = $result->rowCount();
if ($contar > 0){
echo 'foi';
}else{
echo 'n foi';
}
}catch (PDOException $e){
echo "<strong>ERRO DE PDO = </strong>".$e->getMessage();
}
}
?>