Jump to content
Fórum Script Brasil
  • 0

Como manter conteúdo dentro dos campos


Jordano Cherobim
 Share

Question

10 answers to this question

Recommended Posts

  • 0
<?php
$cliente = new Cliente();

if(isset($_POST['btnSalvar'])){
    if($_POST['nomeCliente'] == ''){
        $msg = "Preencher todos os campos obrigatórios.";
    }else{
        
        try{
            $dados = array('nomeCliente' => $_POST['nomeCliente']);
            $inserir = new Inserir();
            $inserir->Conectar();
            $inserir->InserirRegistro('cliente', $dados);
            $inserir->Desconectar();
            $msg = "Inserido com Sucesso!";
        }catch (Exception $erro){
            $inserir->Desconectar();
            $msg = "Erro: {$erro->getMessage()}";
        }

    }

}

?>

<div id="cont">

    <div id="tituloCont">CLIENTE</div>
    <div id="conteudo1">
        
        <form name="cliente" method="post" action="">

            <br>
            <span>Cliente *</span><br>
            <input type="text" name="nomeCliente" id="nomeCliente" value="<?php if (isset($cliente)) echo $cliente->getNome(); else echo @$_POST['nomeCliente']; ?>" size="60" onchange="validaCliente();" autofocus="" required="">
            <br>




            <div id="btnEnviar" style=" text-align: center">
                <input style='margin-right: 20%' type='submit' name='btnSalvar' class='buttonVerde' value='Cadastrar'>
        
            </div>
        </form>

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share



  • Forum Statistics

    • Total Topics
      149.9k
    • Total Posts
      646.8k
×
×
  • Create New...