$ ('# type'). val ('legal');

0

I have a problem with receiving and sending the data to the database because, when creating a system where there is the possibility of using the physical person or the legal person, they send to the same php page using the mode get I can show you how it works (I always use mothod post) ..

localhost/php/action_cadastro.php?tipo=fisica&txtNome=elizandro+rafael+schmidt&txtEndereco=sanntos+dumont&txtBairro=lolo&txtCidade=louco&txtUf=SC&txtCep=02210-202&txtEmail=elizandro159%40gmail.com&txtTelefone=%2802%29+9390-3000&txtCelular=&txtRazaoSocial=&txtCnpj=&txtNomeFantasia=&txtEndereco2=&txtBairro2=&txtCidade2=&txtUf2=SC&txtCep2=&txtEmail2=&txtTelefone2=&txtFax2=&txtCelular2=&txtSite=&login=&senha=&senha2=

**

But the problem is that I do not know how to create the condition where I can read the physical or legal type, I tried this way:

$tipo= $_post['tipo'];
if($tipo==="juridica"){ tantmatnantant
}else{
if($tipo==="fisica"){blablablablabla
}

But by storing that way it goes null to the database, which is correctly connected taking all the variables of the physics. (detail I used the same table to avoid inconvenience in the login)

   $query = " INTO usuario (tipo,Nome,Endereco,Bairro,Cidade,Uf,Cep,Email,Telefone,Celular,Razao,Cnpj,Fantasia,Endereco2,Bairro2,Cidade2,Uf2,Cep2,Email2,Tel2,Fax2,Celular2,site,login,senha,data,hora)
         VALUES ('$tipo','$Nome','$Endereco','$Bairro','$Cidade','$Uf','$Cep','$Email','$Telefone','$Celular','$Razao','$Cnpj','$Fantasia','$Endereco2','$Bairro2','$Cidade2','$Uf2','$Cep2','$Email2','$Tel2','$Fax2','$Celular2','$site','$login','$senha','$data','$hora')"or die ("1337");
          $insert = mysql_query ($query,$conexao); 
asked by anonymous 18.05.2016 / 20:41

1 answer

0

In your example you use the GET method to submit the form and get the return with POST. When submitting the form using GET get the return with $_GET , if sending using POST get the return with $ _POST.

Note that the php $ _POST variable is case sensitive , so $ _POST is different from $ _post. In your code you use both cases. Change all to $_POST (uppercase).

I hope I have helped:)

    
19.05.2016 / 16:34