What i want to do is to display values from database on checkbox labels. i already did that part.
$acc = $truckerController->GetAccessory();
$acc_result = "<form action='' method='post'>";
foreach ($acc as $value) {
$id = $value->id;
$device = $value->device;
$acc_result .= "<input type='checkbox' name='$device' id='$device' value='$id'>"
. "<label for='$device'>$device</label> ";
}
$acc_result .= "<input type='submit' name='acc_submit' value='submit'><form/>";
echo $acc_result;
but what i want to accomplish is when submitting checked values i cant seem to get the checked values. if (isset($_POST["acc_submit"])) { echo $_POST["$device"]; }
Help please!
Aucun commentaire:
Enregistrer un commentaire