Jump to content
Fórum Script Brasil
  • 0
Sign in to follow this  
bsmachado

Cadastro de Clientes

Question

1 answer to this question

Recommended Posts

  • 0

Clientes.html

<HTML>

<HEAD>

<TITLE>Cadastro Clentes</TITLE>

<STYLE>

BODY{

SCROLLBAR-FACE-COLOR:BLACK;

SCROLLBAR-ARROW-COLOR:WHITE;

SCROLLBAR-DARKSHADOWN-COLOR:WHITE

SCROLLBAR-SHADOWN-COLOR:WHITE;

SCROLLBAR-3DLIGHT-COLOR:WHITE;

SCROLLBAR-TRACK-COLOR:BLACK;

}

</STYLE>

</HEAD>

<BODY bgcolor="#000000" text="#FF0000">

<FIELDSET><LEGEND><h4>Cadastro de Clientes</h4></LEGEND>

<FORM action=cadastro_clientes.php method=post name="form1" onSubmit="return Nome(this)" >

<P align="center">&nbsp; </P>

<P>Nome&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<INPUT

name="nome" codigo="nome" type="text" >

&nbsp;&nbsp; &nbsp;</P>

<P>RG/CNPJ

<INPUT

name="rg" codigo="rg" type="text" >

</P>

<P>Endereço&nbsp;

<INPUT

name="end" codigo="end" type="text" >

&nbsp;&nbsp;&nbsp; CEP&nbsp;&nbsp;&nbsp;&nbsp;

<INPUT

name="cep" codigo="cep" type="text" maxlength="9" >

</P>

<P>Cidade&nbsp;&nbsp;&nbsp;&nbsp;

<INPUT

name="cid" codigo="cid" type="text" >

&nbsp;&nbsp;&nbsp; Bairro&nbsp;&nbsp;

<INPUT

name="bairro" codigo="bairro" type="text" >

&nbsp; Estado&nbsp;

<SELECT

size=1 name="est" codigo="est" type="text" >

<option value="0">UF</option>

<option>AC</option>

<option>AL</option>

<option>AM</option>

<option>AP</option>

<option>BA</option>

<option>CE</option>

<option>DF</option>

<option>ES</option>

<option>GO</option>

<option>MA</option>

<option>MG</option>

<option>MS</option>

<option>muito</option>

<option>PA</option>

<option>PB</option>

<option>PE</option>

<option>PI</option>

<option>PR</option>

<option>RJ</option>

<option>RN</option>

<option>RO</option>

<option>RR</option>

<option>RS</option>

<option>SC</option>

<option>SE</option>

<option>SP</option>

<option>TO</option>

</SELECT>

</P>

<P>Telefone&nbsp;&nbsp;

<INPUT

name="tel" codigo="tel" type="text" maxlength="14" >

&nbsp;&nbsp;&nbsp;&nbsp;E-mail&nbsp;

<INPUT

name="email" codigo="email" type="text" >

</P>

<P>&nbsp;&nbsp;&nbsp;

<INPUT type=submit value=Gravar name=gravar>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<INPUT type=reset value=Limpar name=limpar>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

</FORM>

<script Language="JavaScript">

<!--

function Nome()

{

nm=document.form1.nome.value

id=document.form1.rg.value

ende=document.form1.end.value

cp=document.form1.cep.value

cd=document.form1.cid.value

br=document.form1.bairro.value

es=document.form1.est.value

tl=document.form1.tel.value

em=document.form1.email.value

if( nm == "" )

{

alert("Digite o Nome")

return false

}

else if( id == "" )

{

alert("Digite o RG/CNPJ ")

return false

}

else if( ende == "" )

{

alert("Digite o Endereço")

return false

}

else if( cp == "" )

{

alert("Digite o Cep")

return false

}

else if( cd == "" )

{

alert("Digite a Cidade")

return false

}

else if( br == "" )

{

alert("Digite o Bairro")

return false

}

else if( es != "" )

{

alert("Digite o Estado ")

return false

}

else if( tl == "" )

{

alert("Digite o Telefone")

return false

}

else if( em == "" )

{

alert("Digite o E-mail")

return false

}

}

//-->

</Script>

</FIELDSET>

</body>

</html>

cadastro_clientes.php

<? // Fazendo variáveis de conexão

$servidor="localhost"; //nomedoservidor:porta

$usuario = "root"; // nome do usuário

$senha = ""; // senha

$db = "jack_sperrow"; // base de dados

// Fazendo conexão

echo $sql;

$conexao = mysql_connect($servidor, $usuario);

$con = mysql_select_db($db, $conexao);

// Verificando se conexao existe

if(!($con)){

// Se não existe, avisa

echo "não conectado";

}

else{

$nome = $_POST['nome'];

$sql = "INSERT INTO jd (codigo,nome,id,endereco,cep,cidade,bairro,estado,telefone,email) values ('$cod','$nome','$rg','$end','$cep','$cid','$bairro','$est','$tel','$email')";

$resposta = mysql_query($sql, $conexao);

}

// Existindo abre a página HTML;

echo "<BODY bgcolor='#000000' text='#FF0000'>";

echo "<h2>Cadastro efetuado com sucesso</h2>";

echo "<pre><a href='menu.htm'>Voltar ao menu</a></pre>";

echo "<pre><a href='clientes.htm'>Inserir novo Cadastro</a></pre>";

// Fazendo a consulta ao banco usando SQL

?>

Share this post


Link to post
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.

Sign in to follow this  



  • Forum Statistics

    • Total Topics
      148561
    • Total Posts
      644241
×
×
  • Create New...