initial commit
This commit is contained in:
27
orcamento/inc_orcamento.php
Normal file
27
orcamento/inc_orcamento.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
if (session_status() !== PHP_SESSION_ACTIVE){
|
||||
session_start();
|
||||
}
|
||||
$data = (empty($_POST["dat"])) ? 0: $_POST["dat"];
|
||||
$valor = (empty($_POST["valor"])) ? 0: $_POST["valor"];
|
||||
$id_prestador = (empty($_POST["id_prestador"])) ? 0: $_POST["id_prestador"];
|
||||
$data_expiracao = (empty($_POST["data_expiracao"])) ? 0: $_POST["data_expiracao"];
|
||||
$id_cliente = (empty($_POST["id_cliente"])) ? 0: $_POST["id_cliente"];
|
||||
$id_servico = (empty($_POST["id_servico"])) ? 0: $_POST["id_servico"];
|
||||
$observacao = (empty($_POST["observacao"])) ? " ": $_POST["observacao"];
|
||||
include('../conexao.php');
|
||||
|
||||
$query = "INSERT INTO orcamentos (data, valor, id_prestador, data_expiracao, id_cliente, id_servico, observacao)
|
||||
VALUES ('$data', '$valor', '$id_prestador', '$data_expiracao', '$id_cliente', '$id_servico', '$observacao')";
|
||||
$resu = mysqli_query($con, $query);
|
||||
if (mysqli_insert_id($con)) {
|
||||
$_SESSION['msg'] = "<p style='color: blue;'> Orçamento cadastrado com sucesso!</p>";
|
||||
header('Location: index.php');
|
||||
}
|
||||
else{
|
||||
$_SESSION['msg'] = "<p style='color: red;'> Orçamento não foi cadastrado!</p>";
|
||||
header('Location: index.php');
|
||||
}
|
||||
mysqli_close($con);
|
||||
?>
|
||||
|
Reference in New Issue
Block a user