Mam kilka pól checkbox , którymi chciałbym przekazywać zmienne metodą POST
<form name = "someForm" method = "post" action = "#"> <input type="checkbox" name="vehicle" value="Bike" /> I have a bike
<br /> <input type="checkbox" name="vehicle" value="Car" /> I have a car
<br/> <input type="checkbox" name="vehicle" value="Aeroplane" /> I have an aeroplane
<br /> <input type="checkbox" name="vehicle" value="Ship" /> I have a ship
<br/> <input type="submit" name="submit" value="submit">Submit
</>
if (!empty($_POST['imie'])) { $wh[] = 'imie = '.'"'.$_POST['imie'].'"'; //imie
}
if (!empty($_POST['nazwisko'])) { $wh[] = 'nazwisko = '.'"'.$_POST['nazwisko'].'"'; //nazwisko
}
if (!empty($_POST['adres'])) { $wh[] = 'adres = '.'"'.$_POST['adres'].'"'; //adres
}
if (!empty($_POST['miejscowosc'])) { $wh[] = 'miejscowosc = '.'"'.$_POST['miejscowosc'].'"'; //miejscowosc
}
//
$where = 'WHERE '.implode(' and ', $wh); $query = 'SELECT * FROM tabela '.$where.' ORDER BY id DESC';
} else {
$query = 'SELECT * FROM tabela ORDER BY id DESC';
}