Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

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.

checkbox values using setField and $_ POST

Featured Replies

hello..

i have a form with several checkboxes available for each hotel room night:

Nite_1_Check

Nite_2_Check

...

if i submit the form WITH a box checked, no problem. If i don't select the box and submit, it errors out "Notice: Undefined index: Nite_1_Check... Here's what i started with:


$edit->setField('Nite_1_Check', $_POST['Nite_1_Check']);





when that didn't work (if unchecked), i tried several variations of:





if ($_POST['Nite_1_Check'] != NULL) {

  $edit->setField('Nite_1_Check', $_POST['Nite_1_Check']);

  } else {

  $edit->setField('Nite_1_Check', NULL);

}

but that doesn't work. Since all of my other (non- checkbox) fields work fine, i have a feeling this has something to do with PHP not being able to send/POST a NULL value(?). Am i approaching this right?

thanks..

  • Author

got it.. i had to use an "isset"


if (isset($_POST['Nite_1_Check'])) {

	$edit->setField('Nite_1_Check', $_POST['Nite_1_Check']);

		} else {

	$edit->setField('Nite_1_Check', NULL);

	}

works great.. hooray for trial/error :

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

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.