January 27, 201115 yr Hi, I was wondering if anyone could help me ... i'm currently trying to store the values of some checkboxes into a database but for some reason I don't think I am doing it correctly. Could someone offer advice? Here is my code: <input type="checkbox" name="LogoRedesignReason[]" value="Changing_Market"> <label>Update the overall look</label> <br /> <input type="checkbox" name="LogoRedesignReason[]" value="Raise_Profile"> <label>To reflect the changing market</label> <br /> <input type="checkbox" name="LogoRedesignReason[]" value="Change_Direction"> <label>Raise profile</label> <br /> and here is my php code: if (isset($_POST['LogoRedesignReason'])) { $getLogoRedesignReason = serialize($_POST['LogoRedesignReason']); } else { $getLogoRedesignReason = FALSE; echo '<p>No checkboxes were checked.</p>'; } Then obviously I go about inserting that data into the database. The problem i'm getting is the stored data is appearing like this: s:0:""; Which I believe is incorrect?!?
January 27, 201115 yr Basic checkbox: http://www.homeandlearn.co.uk/php/php4p11.html Checkbox array (what you're trying to do): http://www.html-form-guide.com/php-form/php-form-checkbox.html
January 27, 201115 yr if (isset($_POST['LogoRedesignReason'])) { $getLogoRedesignReason = implode(",\n", $_POST['LogoRedesignReason'])); } else { $getLogoRedesignReason = FALSE; echo '<p>No checkboxes were checked.</p>'; }
Create an account or sign in to comment