I have a form that in certain fields returns me several possibilities of data in a single index when I make print of array
. This situation can be seen in índices 3, 4, 5 e 7
.
Array
(
[0] => APARTAMENTO
[1] => CASA
[2] => CASA EM CONDOMINIO
[3] => COBERTURA/COBERTURA HORIZONTAL
[4] => CONJUNTO/SALA/LOJA
[5] => FLAT/LOFT
[6] => PREDIO COMERCIAL
[7] => TERRENO/AREAS
)
I need to get this result in PHP
so that I can start my queries in the database:
Array
(
[0] => APARTAMENTO
[1] => CASA
[2] => CASA EM CONDOMINIO
[3] => COBERTURA
[4] => COBERTURA HORIZONTAL
[5] => CONJUNTO
[6] => SALA
[7] => LOJA
[8] => FLAT
[9] => LOFT
[10] => PREDIO COMERCIAL
[11] => TERRENO
[12] => AREAS
)
I came to this result with this form:
<input type="checkbox" name="tipo[]" value="APARTAMENTO" id="tp1">
<label for="tp1">Apartamento</label>
<input type="checkbox" name="tipo[]" value="CASA" id="tp2">
<label for="tp2">Casa</label>
<input type="checkbox" name="tipo[]" value="CASA EM CONDOMINIO" id="tp3">
<label for="tp3">Casa Condomínio</label>
<input type="checkbox" name="tipo[]" value="COBERTURA/COBERTURA HORIZONTAL" id="tp4">
<label for="tp4">Cobertura</label>
<input type="checkbox" name="tipo[]" value="CONJUNTO/SALA/LOJA" id="tp5">
<label for="tp5">Conjunto/Sala/Loja</label>
<input type="checkbox" name="tipo[]" value="FLAT/LOFT" id="tp6">
<label for="tp6">Flat/Loft</label>
<input type="checkbox" name="tipo[]" value="PREDIO COMERCIAL" id="tp7">
<label for="tp7">Prédio Comercial</label>
<input type="checkbox" name="tipo[]" value="TERRENO/AREAS" id="tp8">
<label for="tp8">Terreno/Área</label>
Passing only this as an instruction:
$tipo = $_GET['tipo'];
For layout reasons, I can not make these fields any different, like um tipo por input
. Any ideas ??