First off, I'm new to array manipulation, so please bear with me. I've got an issue that I've made some progress upon, but I can't get the entire thing working. I have a set of tables that define multiple options within a group.
Table_1 Table_2 Table_1_lu Table_2_lu
id, name id, name id, value,userid id, value, userid
1, Ducati 1, Track 1, 1, wxyz 1, 3, 2222
2, Honda 2, Touring 2, 1, 2xyz 2, 3, wxyz
3, Buell 3, Supersport 3, 1, 2222 3, 1, wxyz
4, Drag Racing 4, 3, 2222
There's also a Table_User that has contact information and the automatically generated userid variable inserted into the Table_X_lu tables.
I have a search page where I display the contents of Table_1, then Table_2 so the users can select the boxes indicating which items they would like to search for.
I have it working properly if and only if they only choose items from Table_1 but not Table_2. The $_POST variable on the search results page amalgamates everything, so that I can't differentiate between the search results of Table_1 and Table_2.
function get_checkbox_labels($table_name,$sv) {
$arr = array();
$query = "SELECT * FROM $table_name ORDER BY name";
$qid = mysqli_query($connection, $query);
while($row= mysqli_fetch_object($qid)) {
array_push($arr, $row);
}
$sv=$arr;
return $sv;
}
So I return the array $sv properly, but everything is grouped together (Table_1 and Table_2 searches).
How do I go about having the resulting checkboxes from Table_1 pushed into its own array, Table_2 results pushed into its own array, instead of having it all combined into one giant variable that gets stuck in $_POST.
I'm trying to be as concise as possible, but will provide any further relavent information that is needed. Thanks.