banco_projeto/orcamento/edit_orcamento.php

71 lines
2.7 KiB
PHP
Raw Permalink Normal View History

2021-09-02 08:27:03 -03:00
<?php
session_start();
include_once("../conexao.php");
include('../menu.php');
$id = filter_input(INPUT_GET, 'id', FILTER_SANITIZE_NUMBER_INT);
$result = "SELECT * FROM orcamentos WHERE id = '$id'";
$resultado = mysqli_query($con, $result);
$row = mysqli_fetch_assoc($resultado);
$id_cli = $row['id_cliente'];
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title> Editar orçamento </title>
<link rel="stylesheet" href="../css/menu.css">
<link rel="stylesheet" href="../css/forms.css">
<link rel="stylesheet" href="../css/article.css">
<link rel="stylesheet" href="../css/input.css">
</head>
<body>
<?php
echo $nav;
?>
<article>
<section class='center'>
<a href="index.php">Listar</a>
<?php if(isset($_SESSION['msg'])){?>
<div class="msg">
<?php echo $_SESSION['msg'];
unset($_SESSION['msg']);?>
</div>
<?php }?>
<h1> Alterar orçamentos </h1>
<form method="POST" action="proc_edit_orcamento.php">
<input type="hidden" name="id" value="<?php echo $row['id']; ?>">
<input type="hidden" name="id_prestador" value="<?php echo $row['id_prestador']; ?>">
<input type="hidden" name="id_cliente" value="<?php echo $row['id_cliente']; ?>">
<input type="hidden" name="id_servico" value="<?php echo $row['id_servico']; ?>">
<p>Data: <input type="date" name="data" value="<?php echo $row['data'];?>"></p>
<p>Valor: <input type="number" name="valor" value="<?php echo $row['valor'];?>"></p>
<p>Data de expiração: <input type="date" name="data_expiracao" value="<?php echo $row['data_expiracao'];?>"></p>
<p>Oberservação: <input type="text" name="observacao" value="<?php echo $row['observacao'];?>"></p>
<label> Cliente: </label>
<select name="id_cliente">
<?php
$query = 'SELECT * FROM tbclientes ORDER BY nome';
$resu = mysqli_query($con, $query) or die(mysqli_connect_error());
while($reg = mysqli_fetch_array($resu)){
if(strcasecmp($reg['nome'],'ADMINISTRADOR') != 0){
?>
<option value="<?php echo $reg['id'];?>" <?php if($reg['id'] == $id_cli) echo "selected";?>><?php echo $reg['nome']?></option>
<?php
}
}
?>
</select><br><br>
<p><a class='button' href='edit_servico.php?id=<?php echo $id?>'>Alterar Serviço</a></p>
<p><a class='button' href='edit_prestador.php?id=<?php echo $id?>&id_pre=<?php echo $row['id_prestador']?>'>Alterar Prestador</a></p>
<table class='input'>
<td><input class='buttons' type="submit" value="Salvar"></td>
<td><input class='buttons' type="reset" value="Limpar"></td>
</table>
</form>
</section>
</article>
<?php echo $footer;?>
</body>
</html>