Form does not register, no name gets recorded [duplicate]

-4

My form is not saving any data in the database, what can it be?

<div id="formulario">      <div align="left">
    <?php

      if(isset($_SERVER['REQUEST_METHOD']) AND $_SERVER['REQUEST_METHOD'] == 'POST'){

        extract($_POST);

    if(isset($nome))
        if($nome === '' OR strlen($nome)<4){
            echo 'Insira um nome existente';
        }elseif($sobrenome=='' OR strlen($sobrenome)<6){ 
            echo 'Insira um sobrenome existente';
        }elseif($email==''){
            echo 'Insira seu e-mail';
        }elseif(!preg_match("/^[az0-9_\.\-]+@[az0-9_\.\-}*{a-z0-9_\-]+\.[a-z]{2,4}$/i",$email)){
            echo 'E-mail invalido tente outro';
        }else{

            include('../../sllapsocial/classes/DB.class.php');

            $verificar = DB::getConn()->prepare("SELECT 'id' FROM 'usuarios' WHERE 'email'=?");
            if($verificar->execute(array($email))){
                if($verificar->rowCount()>=1){
             echo 'Este e-mail ja existe';

         }elseif($senha=='' OR strlen($senha)<4){
            echo'Senha fraca Insira mais caracteres';
         }elseif(strtolower($capctha) <> strtolower($_SESSION['capcthaCadastro'])){
             echo 'Codigo errado';
         }else{
             $senhaInsert = sha1($senha);
             $nascimento = "$ano-$mes-$dia";
             $inserir = DB::getConn()->prepare("INSERT INTO 'usuarios' SET 'email'=?, 'senha' =?, 'nome'=? 'sobrenome'=?, 'sexo'=?, 'nascimento'=?'cadastro'=NOW()");

             if($inserir->execute(array($nome,$sobrenome,$email,$senhaInsert,$nascimento,$sexo))){
            header('Location: ./');  
               }

            }

           }

        }

        }

      ?>
  </div>
  <h3 align="left">Para ter acesso,É facil e gratis.</h3>
 <form name="cadastro" action="" method="post" >
   <div>
    <div class="inputfloat">
         <div align="left"><span>Nome</span>
         <input name="Nome" type="text" class="txtInput" value="<?php if(!empty($nome)) echo $nome; ?>" size="40"/>
         <div>

          <div class="inputfloat">
             <span>Sobrenome</span>
             <input name="Sobrenome" type="text" class="txtInput" value="<?php if(!empty($sobrenome)) echo $sobrenome; ?>" size="40"/>
             <div>

           <span class="spanHide">Seu e-mail</span>
             <input name="Seu e-mail" type="text" class="txtInput" value=" <?php  if(!empty($email)) echo $email; ?>" size="40"/>

             <span class="spanHide">Insira o e-mail novamente</span>
             <input name="Insira o e-mail novamente" type="text" class="txtInput" size="40" value=" <?php if(!empty($email)) echo $email; ?>" />

             <span class="spanHide">Senha</span>
             <input name="Senha" type="password" class="txtInput" size="40" value="<?php  if(!empty($senha)) echo $senha; ?>" />

           <span class="spanHide">Data de nascimento</span>
             <select name="Dia">
               <option value="">Dia</option>
               <?php 
         for($d=1;$d<=31;$d++){
             $zero = ($d<10) ? 0 : '';
             if(!empty($dia)==$zero.$d){
             echo '<option selected="selected" value="',$zero,$d,'">',$zero,$d,'</option>';
             }else{
             echo '<option value="',$zero,$d,'">',$zero,$d,'</option>';
             }

         }

      ?>

             </select>

             <select name="Mes">
               <option value="">M&ecirc;s</option>
               <?php
       $meses = array('','janeiro','fevereiro','março','abril','maio','junho','julho','agosto','setembro','outubro','novembro','dezembro');
       for($m=1;$m<=12;$m++){
       $zero = ($m<10) ? 0 : '';
       if($zero.$m == $meses){
        echo '<option selected="selected"value="',$zero,$m,'">',$meses[$m],'</option>';
       }else{
            echo '<option "value="',$zero,$m,'">',$meses[$m],'</option>';
       }
       }
      ?>

             </select>

             <select name="Ano">
               <option value="">Ano</option>
               <?php
      for($a=date('Y');$a>=(date('Y')-100);$a--){
          if(!empty($ano)){
              echo '<option selected"selected" value="',$a,'">',$a,'</option>';
          }else{
              echo '<option value="',$a,'">',$a,'</option>';      
        }
      }
      ?>

             </select>

             <span class="spanHide">Sou do sexo</span>
             <select name="sexo">
               <option <?php if(!empty($sexo) == 'masculino') echo'selected"selected"'; ?> value="masculino" >Masculino</option> 
               <option <?php if(!empty($sexo) == 'feminino') echo'selected"selected"'; ?>value="feminino" >Feminino</option> 
             </select>         
    </div>
    <div class="captchafloat">
             <div align="left"><img src="../site/captcha.php" /></div>
    </div>

         <div class="inputFloat">
           <div align="left"><span>Digite o código acima:</span>
             <input class="txtInput" type="text" name="captcha"  />
             <input type="submit" value="Continue" class="SubmitContinue" name="Continue" />
        </form>
    </div><!--formulario-->
    
asked by anonymous 22.09.2014 / 02:32

1 answer

2

1 - Be careful when typing field names / variables in html / php Nome is different from nome , see in your form how this setting is:

<input name="Nome" type="text"

In the php after extract () it will become $Nome and not $nome .

if(isset($nome))

2- sql

Appear to be syntax error in insert:

INSERT INTO 'usuarios' SET
 'email'=?,
 'senha' =?,
 'nome'=? <---- falta uma virgula
 'sobrenome'=?,
 'sexo'=?,
 'nascimento'=? <---- aqui também
 'cadastro'=NOW()

Whenever mysql returns the code 1064 it is always some syntax error like wrong column / table name or quotes in wrong places.

The error message looks like this:

  

Error Code: 1064. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1

List of mysql error codes

Syntax for insert alternative

    
22.09.2014 / 04:32