Ir para conteúdo
Fórum Script Brasil

rohde

Membros
  • Total de itens

    6
  • Registro em

  • Última visita

Posts postados por rohde

  1. Tenho o seguinte código que cria um calendario com seus eventos
     
     
    Quero transforma-lo ele na vertical da seguinte " forma "
     

     

    data           \ hora \ evento
    10-1 (seg)     \ 12hr \ teste
                   \ 14hr \ teste 4
    12-1  (ter)    \ 12hr \ teste 2
                   \ 14hr \ teste 3

     

     
    alguém pode ajudar?
  2. Bom galera

    no meu cadastro tenho uma div com o nome "resposta"

    nela retorno os erros... "O nome deve ser preenchido..." etc...

    eu gostaria q ele retornasse todos os erros encontrados (validacao) de uma só vez...

    e q tb a div ficasse "vermelho" quando tivesse erro e verde quando tivesse tudo certo..

    alguém poderia me ajudar?

    cadastro.php

    <?php
    
    # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
    #                 #
    # // Cabeçalho -> caracter usado é utf-8       #
    #                 #
    # // Cabeçalho -> Não armazenar em cache a página     #
    #                 #
    # // Uso a função utf8_encode para transformar os caracteres  #
    # // especiais (acentos, ç, etc) em caracteres utf-8.         #
    #                 #
    # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
    
    // Includes
    include_once "configa.php";
    
    header("Content-type: text/html; charset=utf-8");
    header("Cache-Control: no-store, no-cache, must-revalidate");
    header("Cache-Control: post-check=0, pre-check=0", false);
    header("Pragma: no-cache");
    
    // Define variáveis
    $msg = null;
    $erro = "<div id=\"erro\" class=\"erro\" align=\"justify\"><img src=\"img/erro.png\" alt=\"ERRO!\" width=\"20\" height=\"20\" longdesc=\"ERRO!\" /> Os seguintes erros foram encontrados: <BR />";
    $erro1= "</div>";
    $varTreinador  = isset($_POST["txtTreinador"]) ? $_POST["txtTreinador"] : "";
    $varDataNasc = isset($_POST["txtDataNasc"]) ? $_POST["txtDataNasc"] : "";
    $varTelefone  = isset($_POST["txtTelefone"]) ? $_POST["txtTelefone"] : "";
    $varEquipe  = isset($_POST["txtEquipe"]) ? $_POST["txtEquipe"] : "";
    $varNickForum = isset($_POST["txtNickForum"]) ? $_POST["txtNickForum"] : "";
    
    
    if (trim($varTreinador == "")) {
            $msg = "- O campo \"Treinador\" deve ser preechido! <br />";
    } else if (trim($varDataNasc == "")) {
            $msg = "- O campo \"Data de Nascimento\" deve ser preechido! <br />";
    } else if (trim($varTelefone == "")) {
            $msg = "- O campo \"Telefone\" deve ser preechido! <br />";
    } else if (trim($varEquipe == "")) {
            $msg = "- O campo \"Equipe\" deve ser preechido! <br />";
    } else if (trim($varNickForum == "")) {
            $msg = "- O campo \"Nick Fórum\" deve ser preenchido!<br />";
    } else {
            
            // Cadastra cliente
            $query  = ("INSERT INTO treinadores(treinador,datanasc,telefone,equipe) VALUES('$varTreinador','$varDataNasc','$varTelefone','$varEquipe')");
            $result = mysql_query($query);
            
            if($result)
      $msg = 1;
            else
      $msg = "Erro ao cadastrar o treinador!<br>".mysql_error();
    }
    
    if(isset($msg)) {
            echo utf8_encode($erro.$msg.$erro1);
    }
    
    ?>
    index.php
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>:: Cadastro de Treinador ::</title>
    <script type="text/javascript" src="js/js.js"></script>
    <script type="text/javascript" src="js/mascara.js"></script>
    <style type="text/css" media="screen">
        @import url("css/original.css.php");
    </style>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /></head>
    
    <body>
    
    <div id="resposta" align="center"></div>
    </center>
    
    <div id="form" class="box">
    <form method="post" id="frmCadastro">
    <label for="Treinador" class="label1">Treinador:</label><input name="txtTreinador" type="text" maxlength="60" id="txtTreinador" onfocus="this.className='anormal'" onblur="this.className='normal'" class="required" title="Enter your name" />
    <label for="Data Nascimento" class="label1">Data Nascimento:</label><input name="txtDataNasc" type="text" maxlength="10" id="txtDataNasc" onfocus="this.className='anormal'" onkeypress="Mascara(this,event,'##/##/####');" onblur="this.className='normal'" /><br/>
    <label for="Telefone" class="label1">Telefone:</label><input name="txtTelefone" type="text" maxlength="14" id="txtTelefone" onkeypress="Mascara(this,event,'(##) ####-####');" onfocus="this.className='anormal'" onblur="this.className='normal'" /><br/>
    <label for="Equipe" class="label1">Equipe:</label><input name="txtEquipe" type="text" maxlength="80" id="txtEquipe" onfocus="this.className='anormal'" onblur="this.className='normal'" /><br/>
    <label for="Nick Fórum" class="label1">Nick Fórum:</label><input name="txtNickForum" type="text" maxlength="40" id="txtNickForum" onfocus="this.className='anormal'" onblur="this.className='normal'" /><br/>
    <label for="MSN" class="label1">MSN:</label><input name="txtMSN" type="text" maxlength="100" id="txtMSN" onfocus="this.className='anormal'" onblur="this.className='normal'" /> <br/>
    <label for="E-mail" class="label1">E-mail:</label><input name="txtEmail" type="text" maxlength="100" id="txtEmail" onfocus="this.className='anormal'" onblur="this.className='normal'" /> <br/>
    <label for="Perfil GG" class="label1">Perfil GG:</label><input name="txtPerfil" type="text" maxlength="120" id="txtPerfil" onfocus="this.className='anormal'" onblur="this.className='normal'" /> <br/><br/> 
    <div align="center">
    <input class="btnVerde" value="Cadastrar" type="button" onclick="__cadastraCliente(this.form);"/>
    <input class="btnVermelho" value="Cancelar" type="button" />
    </div>
    </form>
    </div>
    
    </body>
    </html>
    js.js
    // Define variável global
    var xmlhttp;
    
    function __cadastraCliente(varForm) {
    
    // Define variáveis
    var varTreinador;
    var varTelefone;
    var varTelefone;
    var varEquipe;
    
    // Atribui valores as variáveis
    varTreinador      = escape(varForm.txtTreinador.value);
    varDataNasc = escape(varForm.txtDataNasc.value);
    varTelefone    = escape(varForm.txtTelefone.value);
    varEquipe      = escape(varForm.txtEquipe.value);
    
            // Instancia o objeto, dependendo do navagador
            if (window.XMLHttpRequest) {
      xmlhttp = new XMLHttpRequest();  
            } else if (window.ActiveXObject) {
       xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");  
            } else {
      alert("Seu navegador n&atilde;o suporta XMLHttpRequest.");
      return;
            }
    
        xmlhttp.open("POST", "cadastro.php", true); 
    
        xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
        xmlhttp.setRequestHeader("Cache-Control", "no-store, no-cache, must-revalidate");
        xmlhttp.setRequestHeader("Cache-Control", "post-check=0, pre-check=0");
        xmlhttp.setRequestHeader("Pragma", "no-cache");
        
            xmlhttp.onreadystatechange = processReqChange;
    
        xmlhttp.send("txtTreinador=" + varTreinador + "&txtDataNasc=" + varDataNasc + "&txtTelefone=" + varTelefone + "&txtEquipe=" + varEquipe);
    }
    
    
    function processReqChange() {
    
            document.getElementById("resposta").innerHTML = "Processando dados...";
        if (xmlhttp.readyState == 4) {      
      if (xmlhttp.status == 200) {
             // xmlhttp.responseText, recebe o valor da variavel $msg de cadastro.php
             if(xmlhttp.responseText == 1) {
        document.getElementById("resposta").innerHTML = "<div <div id=\"erro\" class=\"sucesso\">Treinador cadastrado com seucesso!</div>";
        window.location.href = "http://www.wmonline.com.br";        // Redireciona para uma pagina....
             } else
        document.getElementById("resposta").innerHTML = xmlhttp.responseText;
             
            } else {
                alert("Problemas ao carregar o arquivo.");
            }
        }
    
    }

×
×
  • Criar Novo...