Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*Model
- Proprietarios.php
- -------------------------------------------*/
- public function Cadproprietario(
- $nome,
- $cpf,
- $rg,
- $profissao,
- $endereco,
- $bairro,
- $cidade,
- $uf,
- $cep,
- $telefone,
- $email,
- $info,
- $status,
- $pagamento
- ){
- $sql = "INSERT INTO proprietario SET
- nome = '$nome',
- cpf = '$cpf',
- rg = '$rg',
- profissao = '$profissao',
- endereco = '$endereco',
- bairro = '$bairro',
- cidade = '$cidade',
- uf = '$uf',
- cep = '$cep',
- telefone = '$telefone',
- email = '$email',
- info = '$info',
- data_cad = NOW(),
- status = '$status',
- pagamento = '$pagamento'";
- $this->db->query($sql);
- return $this->db->lastInsertId();
- }
- /*Controller
- proprietariosContoller.php
- -------------------------------------*/
- public function index() {
- $dados = array();
- if(!empty($_POST['nome'])){
- $nome = addslashes($_POST['nome']);
- $cpf = addslashes($_POST['cpf']);
- $rg = addslashes($_POST['rg']);
- $profissao = addslashes($_POST['profissao']);
- $endereco = addslashes($_POST['endereco']);
- $bairro = addslashes($_POST['bairro']);
- $cidade = addslashes($_POST['cidade']);
- $uf = addslashes($_POST['uf']);
- $cep = addslashes($_POST['cep']);
- $telefone = addslashes($_POST['telefone']);
- $email = addslashes($_POST['email']);
- $info = addslashes($_POST['info']);
- $status = addslashes($_POST['status']);
- $pagamento = addslashes($_POST['pagamento']);
- $id = 0;
- $cadProprietario = new Proprietarios();
- $id = $cadProprietario->Cadproprietario(
- $nome,
- $cpf,
- $rg,
- $profissao,
- $endereco,
- $bairro,
- $cidade,
- $uf,
- $cep,
- $telefone,
- $email,
- $info,
- $status,
- $pagamento
- );
- }
- $this->loadTemplate('proprietarios', $dados);
- }
- /*View
- proprietarios.php
- -----------------------------------*/
- <form role="form" method="POST">
- <div class="box-body">
- <div class="form-group">
- <label for="">* Nome</label>
- <input name="proprietario" type="text" class="form-control" id="" placeholder="">
- </div>
- <div class="form-group">
- <label for="">* CPF</label>
- <input name="cpf" type="text" class="form-control" id="" placeholder="">
- </div>
- <div class="form-group">
- <label for="">* RG</label>
- <input name="rg" type="text" class="form-control" id="" placeholder="">
- </div>
- <div class="form-group">
- <label for="">* Profissão</label>
- <input name="profissao" type="text" class="form-control" id="" placeholder="">
- </div>
- <div class="form-group">
- <label for="">* Endereço</label>
- <input name="endereco" type="text" class="form-control" id="" placeholder="">
- </div>
- <div class="form-group">
- <label for="">* Bairro</label>
- <input name="bairro" type="text" class="form-control" id="" placeholder="">
- </div>
- <div class="form-group">
- <label for="">* Cidade</label>
- <input name="cidade" type="text" class="form-control" id="" pplaceholder="">
- </div>
- <div class="form-group">
- <label for="">* CEP</label>
- <input name="cep" type="text" class="form-control" id="" placeholder="">
- </div>
- <div class="form-group">
- <label for="">* Estado</label>
- <input name="uf" type="text" class="form-control" id="" placeholder="">
- </div>
- <div class="form-group">
- <label for="">* Telefone</label>
- <input name="telefone" type="text" class="form-control" id="" placeholder="">
- </div>
- <div class="form-group">
- <label for="">* E-mail</label>
- <input name="email" type="email" class="form-control" id="" placeholder="">
- </div>
- <div class="form-group">
- <label for="">* Forma de Pagamento</label>
- <select name="pagamento" class="form-control">
- <option value="1">Deposito</option>
- <option value="2">Dinheiro</option>
- </select>
- </div>
- <div class="form-group">
- <label for="">Informações Adicionais</label>
- <textarea name="info" class="form-control" id=""></textarea>
- </div>
- <div class="form-group">
- <label for="">* status</label>
- <select name="status" class="form-control">
- <option value="1">Ativo</option>
- <option value="2">Inativo</option>
- </select>
- </div>
- <div class="box-footer">
- <button type="submit" class="btn btn-primary">Cadastrar</button>
- </div>
- </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement