Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Inserting multiple checkbox data into a database

Featured Replies

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?!?

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

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.