0
my php code
<?php
include "conectar.php";
//comando para iserir dados direto do formul?rio para o banco de dados
$nome=$_POST["nome"];
$cpf=$_POST["cpf"];
$identidade=$_POST["identidade"];
$telefone=$_POST["telefone"];
$celular=$_POST["celular"];
$email=$_POST["email"];
$cep=$_POST["cep"];
$endereco=$_POST["endereco"];
$complemento=$_POST["complemento"];
$bairro=$_POST["bairro"];
$cidade=$_POST["cidade"];
$uf=$_POST["uf"];
$sexo=$_POST["sexo"];
$idade=$_POST["identidade"];
$peso=$_POST["peso"];
$individual=$_POST["individual"];
$tresvidas=$_POST["tresvidas"];
$cincovidas=$_POST["cincovidas"];
$sql="INSERT INTO cadsolidario VALUES ('$nome', '$cpf', '$identidade', '$telefone', '$celular', '$email', '$cep', '$endereco', '$complemento', '$bairro', '$cidade', '$uf', '$sexo', '$idade', '$peso', '$individual', '$tresvidas', '$cincovidas')";
$RES=mysqli_query($con,$sql);
$num=mysqli_affected_rows($con);
if($num = "tresvidas"){
include('busca.php');
}else if($num = "cincovidas"){
include('index.php');
}else{
include('consulta-consultas.php');
}
?>
Note: You are entering the data correctly. But aren’t you redirecting what I should do? Thank you!
Hello Flavio, the code is missing.
– Rafael Weber
To compare values use two equal signs
==
and not one (which is attribution)– rray
OK I’ll authenticate and I’ll tell you if there have been changes, thank you! -rray
– Flavio Cordas
I get the feeling you’ll always fall for
else
,$num
receives a number but you compare it to a string...– rray
As for what is happening, should I put $res? I confess that I was totally lost! Rs.
– Flavio Cordas
@Flaviocordas Where do the words "tresvidas" and "cincovidas" come from? From the database?
– I_like_trains
I don’t know what you’re comparing nor the pq, need to explain these details by editing the question.
– rray
Sorry for the delay! i want from the data typed in the form, where $tresvidas=$_POST['tresvidas']; for chosen take me to page php search! Understand?
– Flavio Cordas
tresvidas
is a radio button or select?– rray