Estou tentando fazer uma página de pesquisa, que tem 1 SELECT e 1 INPUT
O SELECT escolhe entre ID, NOME, RG ou CPF
E no INPUT digita o dado. Ex: Se escolheu ID no SELECT digita o ID no INPUT para fazer a pesquisa em ID no Banco de Dados
<form method="post" action="pesquisacadastrohospede.php">
<div class="form-group col-md-3">
<strong>Escolher entre ID, NOME, RG ou CPF </strong>
<select class="browser-default custom-select" name=" ">
</select>
</div>
<div class="form-group col-md-3">
<strong>Digitar ID, NOME, RG ou CPF </strong>
<input class='form-control' type='text' name='rg' size='25' value=''>
</div>
<button class="" type="submit" class="btn btn">Buscar</button>
</form>
Se eu usar o name"rg" do INPUT ele só busca pelos usuários com RG, ai que eu queria poder escolher entre ID, NOME, RG ou CPF.
_____________________
Outra coisa tbm, queria saber como que faço para pesquisar os 4 campos da tabela
TABELA = cadastro CAMPOS = idCad, nome, rg, cpf
No meu código abaixo ele esta fazendo a pesquisa apenas em $rg
[php]
$resultado = mysqli_query($conn, "SELECT * FROM cadastro WHERE rg BETWEEN '$rg' AND '$rg'");
$linhas = mysqli_num_rows($resultado);
while($linhas = mysqli_fetch_array($resultado)){
$idCad = $linhas["idCad"];
$nome = $linhas["nome"];
$endereco = $linhas["endereco"];
$numero = $linhas["numero"];
$cidade = $linhas["cidade"];
$estado = $linhas["estado"];
$cep = $linhas["cep"];
$telResd = $linhas["telResd"];
$telCel1 = $linhas["telCel1"];
$telCel2 = $linhas["telCel2"];
$rg = $linhas["rg"];
$cpf = $linhas["cpf"];
echo'