banco_projeto/orcamento/edit_servico.php

70 lines
2.4 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 = (empty($_POST['id']) ? $_GET['id']: $_POST['id']);
$result = "SELECT * FROM orcamentos WHERE id = '$id'";
$resultado = mysqli_query($con, $result);
$row = mysqli_fetch_assoc($resultado);
$id_prest = (empty($_POST['id_prestador']) ? $row['id_prestador'] : $_POST['id_prestador']);
?>
<!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>
<a href="javascript:history.back()">Voltar</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="data" value="<?php echo $row['data'];?>">
<input type="hidden" name="valor" value="<?php echo $row['valor'];?>">
<input type="hidden" name="data_expiracao" value="<?php echo $row['data_expiracao'];?>">
<input type="hidden" name="observacao" value="<?php echo $row['observacao'];?>">
<input type="hidden" name="id_cliente" value="<?php echo $row['id_cliente'];?>">
<input type="hidden" name="id_prestador" value="<?php echo $id_prest;?>">
<label> Serviços: </label>
<select name="id_servico">
<?php
$query = 'SELECT * FROM consulta_prestador_servico WHERE id_prestador = ? ORDER BY servico ';
$stmt = $con->prepare($query);
$stmt->bind_param('s',$id_prest);
$stmt->execute();
$resu = $stmt->get_result();
while($reg = $resu->fetch_assoc()){
?>
<option value="<?php echo $reg['id_servico'];?>"><?php echo $reg['servico']?></option>
<?php
}
?>
</select>
<br><br>
<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>