0
I made a registration form that adds the information in the Mysql database. But I created a query form and would like to know how to return information from the database.
Insert.php
<?php
error_reporting (E_ALL & ~ E_NOTICE & ~ E_DEPRECATED);
$host = "localhost";
$user = "root";
$pass = "";
$banco = "relacionamentos";
//echo "<pre>";
//print_r($_POST);
//echo "</pre>";
//exit;
$conexao = mysql_connect($host,$user,$pass) or die (mysql_error());
mysql_select_db($banco) or die (mysql_error());
if($_POST['tipo'] == 'cadastro')
{
$inserir = "insert into cadastro(nome,rua,cidade,estado,idade,peso,tamanho,nacionalidade,cabelo,sexo) values ('$_POST[nome]','$_POST[rua]','$_POST[cidade]','$_POST[estado]','$_POST[idade]','$_POST[peso]'"
. ",'$_POST[tamanho]','$_POST[nacionalidade]','$_POST[corCabelo]','$_POST[sexo]')";
?>
HTML:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Busca da Pessoa Ideal</title>
<style>
td{border:1px solid;}
</style>
</head>
<body>
<form>
<h1 align="center">Caracteristicas do seu par ideal</h1>
<table align="center">
<tr><td>Idade Minima: <input type="number" name="idadeMin" min="18"><br>
Idade Maxima: <input type="number" name="idadeMax" min ="18" max="100"><br>
<input type="checkbox" name="idadeQualquer">Qualquer Idade<br></td></tr>
<tr><td>Peso Minimo: <input type="number" name="pesoMin" step="any" min="0"><br>
Peso Maximo: <input type="number" name="pesoMax" step="any" min="0"><br>
<input type="checkbox" name="pesoQualquer">Qualquer Peso<br></td></tr>
<tr><td>Tamanho:
<select name="tamanho" id="tam">
<option value="1314">Entre 1.30 e 1.40</option>
<option value="1415">Entre 1.40 e 1.50</option>
<option value="1516">Entre 1.50 e 1.60</option>
<option value="1617">Entre 1.60 e 1.70</option>
<option value="1718">Entre 1.70 e 1.80</option>
<option value="18">Maior que 1.80</option>
</select>
<br>
<input type="checkbox" name="tamanhoQualquer">Qualquer Tamanho</td></tr>
<br>
<tr><td>Cor do cabelo: <br>
<input type="radio" name="corCabelo" value="Preto">Preto
<input type="radio" name="corCabelo" value="Loiro">Loiro
<input type="radio" name="corCabelo" value="Ruivo">Ruivo
<input type="radio" name="corCabelo" value="Outros">Outros<br>
<input type="checkbox" name="cabeloQualquer">Qualquer Cabelo</td></tr><br>
<tr><td>Sexo: <br>
<input type="radio" name="sexo" value="M">Masculino
<input type="radio" name="sexo" value="F">Feminino
<input type="radio" name="sexo" value="Y">Ambos
<br>
<button type="input" >Enviar</button>
<button type="reset">Apagar</button>
</table><br>
</form>
</body>
</html>
In this case, I wanted when the user typed "Submit", to return the name of the person with that certain characteristics that he passed in the form. You can show me in code how I do it?
– Thun An Freitas Chiu
You don’t make a canoe without wood. Have you considered researching your problem in a divided way? It seems you have a gigantic problem. Analyze more deeply and divide to conquer
– Gleidson2012