<?php
	define('INCLUDE_CHECK',1);
	require "functions.php";
			include "configbd.php";
?>

<!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>Creating a Facebook-like Registration Form with jQuery</title>

<link rel="stylesheet" type="text/css" href="demo.css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="script.js"></script>

<SCRIPT type=text/javascript src="jquery.maskedinput-1.3.js"></script>
<script>
$(document).ready(function(){
$("#cpf").mask("999.999.999-99");

         $("select[name=estado]").change(function(){
            $("select[name=cidade]").html('<option value="0">Carregando...</option>');
             
            $.post("cidade.php",
                  {estado:$(this).val()},
                  function(valor){
                     $("select[name=cidade]").html(valor);
                  }
                  )
             
         });





 
});
</script>


</head>

<body>

<div id="div-regForm">

<div class="form-title">Cadastre-se</div>
<div class="form-sub-title">Inicie hoje mesmo seu Núcleo Educafro!</div>

<form id="regForm" action="submit.php" method="post">

<table>
  <tbody>
  <tr>
    <td><label for="fname">Nome Completo:</label></td>
    <td><div class="input-container"><input name="fname" id="fname" type="text" /></div></td>
  </tr>
  <tr>
    <td><label for="lname">CPF:</label></td>
    <td><div class="input-container"><input  style="width:90px;" name="cpf" id="cpf" type="text" /></div></td>
  <tr>
    <td height="46"><label for="lname">Estado:</label></td>
    <td><div class="input-container">
    
    	  <select name="estado" id="estado">
					  

   <option selected ></option>';
<?php
//clausula sql 
$sql = "SELECT * FROM tb_estados order by uf "; 

//executa a clausula sql 
$result = mysql_query($sql)or die("Falha na execução da instrução SQL!"); 

//faz o loop para preencher o campo criado com os valores retornados na consulta 
while($dados = mysql_fetch_array($result)) 
{ 
echo "<option value='".$dados['id']."'>".$dados['uf']."</option>"; 
} 
?>
</select> 
				
    Cidade:
    <select name="cidade"  id="cidade" >
       <option value="0" disabled="disabled">Escolha um Estado...</option>
    </select>
    
    </div>
    
  <tr>
    <td><label for="lname">Cidade:</label></td>
    <td><div class="input-container"><input name="lname" id="lname" type="text" /></div></td>

  <tr>
    <td><label for="lname">Endereço:</label></td>
    <td><div class="input-container"><input name="lname" id="lname" type="text" /></div></td>
  </tr>
    <tr>
    <td><label for="email">Telefone:</label></td>
    <td><div class="input-container"><input name="telefone" style="width:90px;" id="telefone" type="text" />Celular:<input name="celular" style="width:90px;" id="celular" type="text" /></div></td>
  </tr>

  <tr>
    <td><label for="email">Email:</label></td>
    <td><div class="input-container"><input name="email" id="email" type="text" /></div></td>
  </tr>
  <tr>
    <td><label for="pass">Senha:</label></td>
    <td><div class="input-container"><input name="pass" id="pass" type="password" /></div></td>
  </tr>
  <tr>
    <td><label for="sex-select">Sexo:</label></td>
    <td>
    <div class="input-container">
    <select name="sex-select" id="sex-select">
    <option value="0">Selecione Sexo:</option>
    <option value="1">Feminino</option>
    <option value="2">Masculino</option>
    </select>
    </div>
    
    </td>
  </tr>
  <tr>
    <td><label>Data de Nascimento:</label></td>
    <td>
    <div class="input-container">
    <select name="day"><option value="0">Dia:</option><?=generate_options(1,31)?></select>

    <select name="month"><option value="0">Mês:</option><?=generate_options(1,12,'callback_month')?></select>
	<select name="year"><option value="0">Ano:</option><?=generate_options(date('Y'),1900)?></select>
    </div>
    </td>
  </tr>
  <tr>
  <td>&nbsp;</td>
  <td><input type="submit" class="greenButton" value="CADASTRAR" /><img id="loading" src="img/ajax-loader.gif" alt="working.." />
</td>
  </tr>
  
  
  </tbody>
</table>

</form>

<div id="error">
&nbsp;
</div>

</div>
</body>
</html>
