コード例 #1
0
<?php

require_once $_SERVER['DOCUMENT_ROOT'] . '/model/MCliente.php';
$conCliente = new ConCliente();
$acao = isset($_GET['acao']) ? $acao = $_GET['acao'] : ($acao = "");
$id = isset($_GET['id']) ? $id = $_GET['id'] : ($id = "");
switch ($acao) {
    case 'excluir':
        $resposta = $conCliente->excluirCliente($id);
        header("location:../view/cliente/clientes.php?info={$resposta}");
        break;
    case 'alterar':
        $resposta = $conCliente->alterarCliente($id);
        header("location:../view/cliente/clientes.php?info={$resposta}");
        break;
    case 'novo':
        $rsposta = $conCliente->inserirCliente();
        header("location:../view/cliente/clientes.php?info={$rsposta}");
        break;
    default:
        return 'erro';
}
class ConCliente
{
    protected $cliente;
    function __construct()
    {
        $this->cliente = new MClientes();
    }
    function inserirCliente()
    {
コード例 #2
0
<?php

include_once $_SERVER['DOCUMENT_ROOT'] . '/control/ConCliente.php';
$conCliente = new ConCliente();
$listaClientes = $conCliente->listarClientes();
//print_r($listaClientes);
$info = isset($_GET['info']) ? $info = $_GET['info'] : ($info = "");
?>
<html>
    <head>
        <meta charset="utf-8">
        <title>Clientes</title>
        <?php 
include_once $_SERVER['DOCUMENT_ROOT'] . '/view/head.php';
?>
  
        <script type="text/javascript" src="formularioInserirCliente.js"></script>
        <script>
            $("input").click(function(){
                $('#tel').mask('(99)9999-9999?9');
                $('#cpf').mask('999.999.999-99');
                $('#cnpj').mask('999.999.999/9999-99');
            });
        </script>               
    </head>
    <body>
        <?php 
include $_SERVER['DOCUMENT_ROOT'] . '/view/menu.php';
?>
        <hr>
        <br>