
Sergio Mendes Borges
Membros-
Total de itens
7 -
Registro em
-
Última visita
Sobre Sergio Mendes Borges

Sergio Mendes Borges's Achievements
0
Reputação
-
ele retorna vazio...Mais a conexao esta funcionando e a funcao tambem ajudem encontrar o erro obrigado
-
Ajuda Urgente Sistema de cadastro ... Botão editar <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Cadastro De Usuarios</title> <link rel="stylesheet" media="all" type="text/css" href="css/style.css"/> <style type="text/css"> body,td,th { color: #CCC; } </style> </head> <body class="bodyColor"> <div class="logo" align="center"></div> <form id="form"> <div class="conteudo" align="center"> <center> <table> <tr height="30px"> </tr> <tr> <td width="45"> <label class="textLabel"> Nome: </label> </td> <td colspan="3"> <input class="textField" id="nome" /> </td> <td> </td> <td> </td> </tr> <tr> <td width="45"> <label class="textLabel"> E-mail: </label> </td> <td colspan="3"> <input class="textField" id="email"/> </td> <td> </td> <td> </td> </tr> <tr height="10px"> <td> </td> </tr> <tr> <td width="45"> <label class="textLabel"> Senha: </label> </td> <td colspan="3"> <input type="password" class="textField" id="senha"/> </td> <td> </td> <td> </td> </tr> <tr height="10px"> <td> </td> </tr> <tr> <div class="button" align="center"> <td colspan="2" align="right"> <button class="button" onclick="save();" type="button">Salvar</button> </td> <td> </td> <td colspan="2" align="center"> <button class="button" onclick="cancel();" type="reset">Cancelar</button> </td> <td> </td> </div> </tr> <tr height="20px"> <td> </td> </tr> </table> <? include("php/conexao.php"); $sql = mysql_query("SELECT * FROM usuario ORDER BY nome"); $cont = 0; ?> <div style="overflow:auto; height:250px; width:900px; border-style:solid; border-width:0px;" > <table align="center" width="800" border="1" cellpadding="0" cellspacing="0" bordercolor="#666666"> <tr> <td class="tableHeader"> Nome </td> <td class="tableHeader"> E-mail </td> <td class="tableHeader" width="30"> </td> <td class="tableHeader" width="30"> </td> </tr> <? while($dados = mysql_fetch_array($sql)){ if($cont % 2 == 0){ ?> <tr bgcolor='#D3DBF8'> <td> <font color="#000000"> <? echo $dados["nome"] ?> </font></td> <td> <font color=#000000"> <? echo $dados["email] ?> </font></td> <td align="center" width="30"> <a href="#dialog" onclick="remove(<? echo $dados["id"] ?>)"> <img src=img/delete.png" width="21" height="16" alt="Rastreamento" border="0" style='border:0px;padding:1px;'/> </a> </td> <td align="center" width="30"> <a href="#dialog" onclick="edit( <? echo $dados["id] ?>)"> <img src="img/A_EditInDesigner_Lg_N.png" width="21" height="16" alt="Rastreamento" border="0"style='border:0px;padding:1px;'"/> </a> </td> </tr> </td> </tr> </div> <? } else{ ?> <tr bgcolor='#ECEBFE'" > <td> <font color="#000000"><? echo $dados["nome"] ?> </font></td> <td><font color=#000000"> <? echo $dados["email] ?> </font></td> <td align="center"> </td> </tr> <? } $cont++; } ?> </table> </div> </center> </div> </form> </body> </html> <script type="text/javascript" language="javascript"> function save(){ if(validaForm()){ var nome = document.getElementById("nome").value; var email = document.getElementById("email").value; var senha = document.getElementById("senha").value; enviaForm(nome, email, senha); } } function validaForm(){ if(document.getElementById("nome").value == ""){ alert("Preencha o campo nome"); document.getElementById("nome").focus; return false; } if(document.getElementById("email").value == ""){ alert("Preencha o campo email"); document.getElementById("email").focus; return false; } if(document.getElementById("senha").value == ""){ alert("Preencha o campo senha"); document.getElementById("senha").focus; return false; } if(!validar()){ return false; } return true; } function enviaForm(nome, email, senha){ if(window.XMLHttpRequest) { req = new XMLHttpRequest(); } else if(window.ActiveXObject) { req = new ActiveXObject("Microsoft.XMLHTTP"); } req.open("Get", "php/validaMorador.php?nome=" + nome + "&email=" + email + "&senha=" + senha, true); req.onreadystatechange = function() { if(req.readyState == 4 && req.status == 200) { var resposta = -3; resposta = req.responseText; if(resposta == 0){ //Valido com solicitação de peças alert("Cadastro realizado com sucesso!"); window.location="cadastro.php"; } else if(resposta == -1){ //Valido mas sem solicitação de peças alert("Erro desconhecido!"); } else if(resposta == -2){ alert("Usuário já existente!"); } } } req.send(null); } function remove(id){ var decisao = confirm("Tem certeza que deseja excluir este usuário?"); //OK if (decisao){ if(window.XMLHttpRequest) { req = new XMLHttpRequest(); } else if(window.ActiveXObject) { req = new ActiveXObject("Microsoft.XMLHTTP"); } req.open("Get", "php/removeusuario.php?id=" + id, true); req.onreadystatechange = function() { if(req.readyState == 4 && req.status == 200) { window.location="cadastro.php"; } } req.send(null); } } function validar(){ var str = document.getElementById('email').value; var filter = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i; if(filter.test(str)){ return true; } else{ alert("Este endereço de e-mail não é válido!"); document.cadastro.E-mail.focus(); return false; } } //editei function edit(id){ //OK if(window.XMLHttpRequest) { req = new XMLHttpRequest(); } else if(window.ActiveXObject) { req = new ActiveXObject("Microsoft.XMLHTTP"); } req.open("Get", "php/seleciona.php?id= + id, true); req.onreadystatechange = function() { if(req.readyState == 4 && req.status == 200) { var resposta = -3; resposta = req.responseText; separa(resposta); window.location="cadastro.php"; } } req.send(null); } function separa(text){ var quebra=text.split(","); alert(quebra[0]); alert(quebra[1]); alert(quebra[2]); //FAZ A SEPARAÇÃO DA STRING var z = text.split(","); alert(z[0]); alert(z[1]); alert(z[2]); } </script> seleciona.php <?php $id = $_GET['id]; include("conexao.php"); $sql = mysql_query("SELECT * FROM usuario WHERE id = $id"); $dados = mysql_fetch_array($sql); echo $dados['nome']; ?> Ele esta dando alert com uma , não sei a causa disso...Obg
-
a Funcao respondeu.. Agora preciso fazer ela me da a resposta em um determinado local A funcao Split JS pode ser usada?
-
ele não reconhecer a funcao edit ;O
-
O edit e uma imagem .. amigo so não sei porque ela não ta funcionando <td align="center" width="30"> <a href="#dialog" onclick="Edit('value from a text column here')"> <img src="img/A_EditInDesigner_Lg_N.png" width="21" height="16" alt="Rastreamento" border="0" style='border:0px;padding:1px;'/> </td></a>
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Cadastro De Usuarios</title> <link rel="stylesheet" media="all" type="text/css" href="css/style.css"/> <style type="text/css"> body,td,th { color: #CCC; } </style> </head> <body class="bodyColor"> <div class="logo" align="center"><img src="img/logo3.png" width="247" height="36" /></div> <form id="form"> <div class="conteudo" align="center"> <center> <table> <tr height="30px"> </tr> <tr> <td width="45"> <label class="textLabel"> Nome: </label> </td> <td colspan="3"> <input class="textField" id="nome"/> </td> <td> </td> <td> </td> </tr> <tr> <td width="45"> <label class="textLabel"> E-mail: </label> </td> <td colspan="3"> <input class="textField" id="email"/> </td> <td> </td> <td> </td> </tr> <tr height="10px"> <td> </td> </tr> <tr> <td width="45"> <label class="textLabel"> Senha: </label> </td> <td colspan="3"> <input type="password" class="textField" id="senha"/> </td> <td> </td> <td> </td> </tr> <tr height="10px"> <td> </td> </tr> <tr> <div class="button" align="center"> <td colspan="2" align="right"> <button class="button" onclick="save();" type="button">Salvar</button> </td> <td> </td> <td colspan="2" align="center"> <button class="button" onclick="cancel();" type="reset">Cancelar</button> </td> <td> </td> </div> </tr> <tr height="20px"> <td> </td> </tr> </table> <? include("php/conexao.php"); $sql = mysql_query("SELECT * FROM usuario ORDER BY nome"); $cont = 0; ?> <div style="overflow:auto; height:250px; width:900px; border-style:solid; border-width:0px;" > <table align="center" width="800" border="1" cellpadding="0" cellspacing="0" bordercolor="#666666"> <tr> <td class="tableHeader"> Nome </td> <td class="tableHeader"> E-mail </td> <td class="tableHeader" width="30"> </td> <td class="tableHeader" width="30"> </td> </tr> <? while($dados = mysql_fetch_array($sql)){ if($cont % 2 == 0){ ?> <tr <? echo "bgcolor='#D3DBF8'";?>> <td> <font color="#000000"> <? echo $dados["nome"] ?> </font></td> <td> <font color=#000000"> <? echo $dados["email] ?> </font></td> <td align="center" width="30"> <a href="#dialog" onclick="remove(<? echo $dados["id"] ?>)"> <img src=img/delete.png" width="21" height="16" alt="Rastreamento" border="0" style='border:0px;padding:1px;'/> <td align="center" width="30"> <a href="#dialog" onclick="Edit('value from a text column here')"> <img src="img/A_EditInDesigner_Lg_N.png" width="21" height="16" alt="Rastreamento" border="0" style='border:0px;padding:1px;'/> </td></a> </tr> </td> </tr> </div> <? } else{ ?> <tr <? echo "bgcolor='#ECEBFE'";?> > <td> <font color="#000000"><? echo $dados["nome] ?> </font></td> <td><font color="#000000"> <? echo $dados["email"] ?> </font></td> <td align=center"> </td> </tr> <? } $cont++; } ?> </table> </div> </center> </div> </form> </body> </html> <script type="text/javascript" language="javascript"> function save(){ if(validaForm()){ var nome = document.getElementById("nome").value; var email = document.getElementById("email").value; var senha = document.getElementById("senha").value; enviaForm(nome, email, senha); } } function validaForm(){ if(document.getElementById("nome").value == ""){ alert("Preencha o campo nome"); document.getElementById("nome").focus; return false; } if(document.getElementById("email").value == ""){ alert("Preencha o campo email"); document.getElementById("email").focus; return false; } if(document.getElementById("senha").value == ""){ alert("Preencha o campo senha"); document.getElementById("senha").focus; return false; } if(!validar()){ return false; } return true; } function enviaForm(nome, email, senha){ if(window.XMLHttpRequest) { req = new XMLHttpRequest(); } else if(window.ActiveXObject) { req = new ActiveXObject("Microsoft.XMLHTTP"); } req.open("Get", "php/validaMorador.php?nome=" + nome + "&email=" + email + "&senha=" + senha, true); req.onreadystatechange = function() { if(req.readyState == 4 && req.status == 200) { var resposta = -3; resposta = req.responseText; if(resposta == 0){ //Valido com solicitação de peças alert("Cadastro realizado com sucesso!"); window.location="cadastro.php"; } else if(resposta == -1){ //Valido mas sem solicitação de peças alert("Erro desconhecido!"); } else if(resposta == -2){ alert("Usuário já existente!"); } } } req.send(null); } function remove(id){ var decisao = confirm("Tem certeza que deseja excluir este usuário?"); //OK if (decisao){ if(window.XMLHttpRequest) { req = new XMLHttpRequest(); } else if(window.ActiveXObject) { req = new ActiveXObject("Microsoft.XMLHTTP"); } req.open("Get", "php/removeusuario.php?id=" + id, true); req.onreadystatechange = function() { if(req.readyState == 4 && req.status == 200) { window.location="cadastro.php"; } } req.send(null); } } function validar(){ var str = document.getElementById('email').value; var filter = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i; if(filter.test(str)){ return true; } else{ alert("Este endereço de e-mail não é válido!"); document.cadastro.E-mail.focus(); return false; } } //editei function edita(id){ //OK if(window.XMLHttpRequest) { req = new XMLHttpRequest(); } else if(window.ActiveXObject) { req = new ActiveXObject("Microsoft.XMLHTTP"); } req.open("Get", "php/seleciona.php?id=" + id, true); req.onreadystatechange = function() { if(req.readyState == 4 && req.status == 200) { window.location="cadastro.php"; } } } </script> quero fazer a funcao edita.... seleciona.php <? include("conexao.php"); $id = $_GET['id]; $sql = mysql_query("SELECT * FROM usuario WHERE 'id' = $id"); $dados = mysql_fetch_array($sql); ?>
-
Ola Preciso de ajuda urgente . Estou fazendo um cadastro de usuarios PHP, e não consigo fazer um botão para editar os usuarios.. exemplo o usuario clica muda o email a senha o usuario se alguém puder me ajudar uso MOWES OBG