I have a webpage where people can add what games they have through a checklist and save it to their account.
Here's my save posted checkbox code:
if ($_POST['info']) {
$newinfo = $_POST['info'];
file_put_contents("member/$userid/info.txt", $newinfo);
$games = array();
if (isset($_POST['game'])) {
$games = $_POST['game'];
$gamesready = serialize($games);
$gamesql = mysql_query("UPDATE user SET games='$gamesready' WHERE id='$userid'");
}
header("Location: ".$username);
exit();
}
So I have the whole add checked items to an array, then serialize and store it in a database, but what if I want to pull that array out and check the boxes that were previously marked so that they could be disabled without having to completely recheck the games they previously saved to the array.
I assume I would unserialize the array, then do a foreach and match them up with the checkboxes? If that's so, I would have no idea how to do it. Thanks for your help.