vendredi 13 décembre 2019

Checking if $_POST variable is set using mysql variable

I have a php file that is receiving some checkbox values from a form. Both the checkbox name and value are set up to match an Item_Name field in a mysql table. My current attempt is below:

while($row = $items->fetch_assoc()){
        if( isset($_POST[$row['Item_Name']])) {
            \\ Code to perform if true, mostly echoes
        }
    }

//Checkbox setup: 

echo  "<input type='checkbox' name=" . $row['Item_Name'] .  "value=" . $row['Item_Name'] .  ">"

$items is the data returned by my query of the mysql table. Currently none of the echoes inside the if are triggering so I think something is wrong with my if statement, but I'm to new to php to know what is wrong exactly.




Aucun commentaire:

Enregistrer un commentaire