# Conditionally Cookies save after checkbox click

**URL:** <https://community.gravityforms.com/t/conditionally-cookies-save-after-checkbox-click/1376>\
**Category:** Get Help\
**Tags:** cookies\
**Created:** [March 22, 2019, 3:48pm UTC](https://community.gravityforms.com/t/conditionally-cookies-save-after-checkbox-click/1376 "2019-03-22T15:48:51Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![hyperweb](https://avatars.discourse-cdn.com/v4/letter/h/7993a0/32.png) [@hyperweb](https://community.gravityforms.com/u/hyperweb)\
**Post date:** [March 22, 2019, 3:48pm UTC](https://community.gravityforms.com/t/conditionally-cookies-save-after-checkbox-click/1376/1 "2019-03-22T15:48:51Z")

</div>

Hello,  
I would like to ask you for advice about a form I have recently built. This is the URL where you can check it - [http://cloud.tandet.com/~shipnamerica/request-a-quote/](http://cloud.tandet.com/~shipnamerica/request-a-quote/) .  
There is a checkbox field - “Save my contact information for future Freight Rate Quotes” which should be saving Cookies and fields be auto-populated after the form is once submitted.

At this moment I managed to enable Cookies for the form which are saved once the form is submitted but they should be populated only in a condition after this checkbox is clicked.  
Can you please advice me for a way of doing this.

The code which I used to make this auto-fill after form submission was from this thread - [https://legacy.forums.gravityhelp.com/topic/little-hint-from-me-save-user-input-in-cookie-and-prepopulate-form](https://legacy.forums.gravityhelp.com/topic/little-hint-from-me-save-user-input-in-cookie-and-prepopulate-form)

Hope you can give me advice about setting up this feature with the checkbox.  
Thank you.  
Kind regards.

---

<div class="post-metadata">

**Author:** ![chrishajer](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/chrishajer/32/88_2.png) [@chrishajer](https://community.gravityforms.com/u/chrishajer)\
**Post date:** [March 22, 2019, 5:43pm UTC](https://community.gravityforms.com/t/conditionally-cookies-save-after-checkbox-click/1376/2 "2019-03-22T17:43:01Z")

</div>

What is the code you are using to set the cookie now? If you share that, we might be able to help you check for that checkbox value to conditionally.

---

<div class="post-metadata">

**Author:** ![hiranthi](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/hiranthi/32/359_2.png) [@hiranthi](https://community.gravityforms.com/u/hiranthi)\
**Post date:** [March 22, 2019, 8:21pm UTC](https://community.gravityforms.com/t/conditionally-cookies-save-after-checkbox-click/1376/3 "2019-03-22T20:21:39Z")

</div>

Inside the `pre_submission_handler` there should be a check if the cookie-checkbox (to call it that 😉 ) has been selected and if not: return.

Something along these lines:

```
function pre_submission_handler($form_meta) {
    if ( false == $_POST['input_68'] ) return;
    ....
```

---

<div class="post-metadata">

**Author:** ![hyperweb](https://avatars.discourse-cdn.com/v4/letter/h/7993a0/32.png) [@hyperweb](https://community.gravityforms.com/u/hyperweb)\
**Post date:** [March 25, 2019, 9:48am UTC](https://community.gravityforms.com/t/conditionally-cookies-save-after-checkbox-click/1376/4 "2019-03-25T09:48:05Z")

</div>

Hello Chris and Hiranthi,  
Thank you for your advices. I appreciate it.  
The code which is currently applied in my functions.php is:

```auto
add_action("gform_pre_submission", "pre_submission_handler");
function pre_submission_handler($form_meta) {
	$saveVars = array("name", "email", "phone");

    foreach($form_meta["fields"] as $field) {
		if (in_array($field["inputName"], $saveVars)) {
			setcookie("gf_".$field["inputName"], $_POST["input_" . $field["id"]], time() + 31536000, COOKIEPATH, COOKIE_DOMAIN, false, true);
		}
	}
}

add_filter("gform_field_value_name", "populate_name");
function populate_name() {
	return $_COOKIE["gf_name"];
}
add_filter("gform_field_value_phone", "populate_phone");
function populate_phone() {
	return $_COOKIE["gf_phone"];
}
add_filter("gform_field_value_email", "populate_email");
function populate_email() {
	return $_COOKIE["gf_email"];
}

```

Best Regards, Nick.

---

<div class="post-metadata">

**Author:** ![chrishajer](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/chrishajer/32/88_2.png) [@chrishajer](https://community.gravityforms.com/u/chrishajer)\
**Post date:** [March 25, 2019, 6:28pm UTC](https://community.gravityforms.com/t/conditionally-cookies-save-after-checkbox-click/1376/5 "2019-03-25T18:28:37Z")

</div>

> [@hiranthi](#):
>
> if ( false == $\_POST[‘input\_68’] ) return;

Combining Hiranthi’s code with yours, this should work:

```auto
add_action("gform_pre_submission", "pre_submission_handler");
function pre_submission_handler($form_meta) {
	if ( false == $_POST['input_68'] ) return;
	$saveVars = array("name", "email", "phone");
    foreach($form_meta["fields"] as $field) {
		if (in_array($field["inputName"], $saveVars)) {
			setcookie("gf_".$field["inputName"], $_POST["input_" . $field["id"]], time() + 31536000, COOKIEPATH, COOKIE_DOMAIN, false, true);
		}
	}
}

```

That just checks to see if field 68 (your checkbox field) was submitted, and if not, skip the code to set the cookies.

---

<div class="post-metadata">

**Author:** ![hyperweb](https://avatars.discourse-cdn.com/v4/letter/h/7993a0/32.png) [@hyperweb](https://community.gravityforms.com/u/hyperweb)\
**Post date:** [March 26, 2019, 11:34am UTC](https://community.gravityforms.com/t/conditionally-cookies-save-after-checkbox-click/1376/6 "2019-03-26T11:34:19Z")

</div>

Hello. Thanks so much for the efforts to help solve this.  
I updated with the code above but is not saving cookies after the checkbox is clicked.  
The attached is the code from my functions.php.

 ![Capture](https://us1.discourse-cdn.com/flex020/uploads/gravityforms1/original/2X/a/a6eee4be4faf642242fb72562e3287d17420f176.png)

Best Regards, Nick.  
Thank you.

---

<div class="post-metadata">

**Author:** ![chrishajer](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/chrishajer/32/88_2.png) [@chrishajer](https://community.gravityforms.com/u/chrishajer)\
**Post date:** [March 26, 2019, 7:26pm UTC](https://community.gravityforms.com/t/conditionally-cookies-save-after-checkbox-click/1376/7 "2019-03-26T19:26:18Z")

</div>

> [@chrishajer](#):
>
> add\_action(“gform\_pre\_submission”, “pre\_submission\_handler”); function pre\_submission\_handler($form\_meta) { if ( false == $\_POST[‘input\_68’] ) return;

In the above code, I recommend adding a logging line, like this:

```auto
add_action("gform_pre_submission", "pre_submission_handler");
function pre_submission_handler($form_meta) {
	GFCommon::log_debug( __METHOD__. '(): POST => ' . print_r( $_POST, true ) );
	if ( false == $_POST['input_68'] ) return;

```

That will only be helpful if you enable Gravity Forms logging:

> **[Logging and Debugging](https://docs.gravityforms.com/logging-and-debugging/#enabling-logging)**
>
> For quite a while, enabling logging within Gravity Forms has been a go-to method for debugging any issues within Gravity Forms. As of Gravity Forms version 2.2, logging functionality has been moved from a separate add-on to becoming a core feature of...

The $\_POST will be logged and see can see what is happening and determine if the logic is just plain wrong on something like that.

---

<div class="post-metadata">

**Author:** ![hyperweb](https://avatars.discourse-cdn.com/v4/letter/h/7993a0/32.png) [@hyperweb](https://community.gravityforms.com/u/hyperweb)\
**Post date:** [March 28, 2019, 9:51am UTC](https://community.gravityforms.com/t/conditionally-cookies-save-after-checkbox-click/1376/8 "2019-03-28T09:51:49Z")

</div>

Hello, thank you once again for trying to help my situation!  
I enabled logging and replaced with the code provided above.  
This is what I got from the log document:

```auto
==========================================

2019-03-28 9:45:38.045504 - DEBUG --> GFCommon::post_to_manager(): endpoint: https://www.gravityhelp.com/wp-content/plugins/gravitymanager/api.php?op=upgrade_message&key=0c226b1ae0ce43b4c7100e1f679c3ac1 
2019-03-28 9:45:38.252562 - DEBUG --> GFCommon::log_remote_response(): code: 200; body: <!--GFM--> 
2019-03-28 9:47:15.034734 - DEBUG --> GFFormDisplay::process_form(): Starting to process form (#2) submission. 
2019-03-28 9:47:15.043602 - DEBUG --> GFFormDisplay::process_form(): Source page number: 1. Target page number: 0. 
2019-03-28 9:47:15.050630 - DEBUG --> GFFormDisplay::process_form(): After validation. Is submission valid? Yes. 
2019-03-28 9:47:15.050802 - DEBUG --> GFFormDisplay::process_form(): Submission is valid. Moving forward. 
2019-03-28 9:47:15.051012 - DEBUG --> pre_submission_handler(): POST => Array
(
    [input_1] => Nikolay
    [input_2] => Birimski
    [input_3] => Hyperweb Test
    [input_4] => 
    [input_5] => Hyperweb Test
    [input_6] => Yukon
    [input_7] => 
    [input_8] => 08888888
    [input_9] => 
    [input_10] => nicky@hyperweb.ca
    [input_11] => nicky@hyperweb.ca
    [input_68_1] => 1
    [input_68_2] => Save my contact information for future Freight Rate Quotes
    [input_68_3] => 1
    [input_20] => Hyperweb Test
    [input_22] => Arkansas
    [input_24] => Business
    [input_28] => Hyperweb Test
    [input_29] => Alaska
    [input_30] => Business
    [input_34] => Truckload
    [input_50] => Standard Service
    [input_51] => 53\' High Cube Dry Van
    [input_52] => Yes
    [input_53] => 1
    [input_54] => Kilos
    [input_57] => No
    [input_56] => 
    [input_58] => Actual
    [input_59] => Array
        (
            [0] => 15
            [1] => 3
            [2] => 2019
        )

    [input_60] => Hyperweb Test
    [input_63_2] => Yes! Please sign me up for your free newsletter.
    [input_63_3] => 1
    [is_submit_2] => 1
    [gform_submit] => 2
    [gform_unique_id] => 
    [state_2] => WyJ7XCI2OC4xXCI6XCI5OWU3MjEzZjgyZGM3ZGIzYmY0ZTc3YWQ1OWRkMTdiZVwiLFwiNjguMlwiOlwiZGVkOGEwNTFkNjZhNjNkOTllMDY1YmZhMjhmZjllNjRcIixcIjY4LjNcIjpcIjk5ZTcyMTNmODJkYzdkYjNiZjRlNzdhZDU5ZGQxN2JlXCIsXCI2My4xXCI6XCI5OWU3MjEzZjgyZGM3ZGIzYmY0ZTc3YWQ1OWRkMTdiZVwiLFwiNjMuMlwiOlwiNjlkMTBmNTI1NzcxOGVjZmRlZjBlNDI1MjY2NGIwMTFcIixcIjYzLjNcIjpcIjk5ZTcyMTNmODJkYzdkYjNiZjRlNzdhZDU5ZGQxN2JlXCJ9IiwiNmM3OGI3MmExZTg3OWI2YjU3MGNmYjZlNDA3NmY2NzUiXQ==
    [gform_target_page_number_2] => 0
    [gform_source_page_number_2] => 1
    [gform_field_values] => 
)
 
2019-03-28 9:47:15.051192 - DEBUG --> GFFormsModel::save_entry(): Saving entry. 
2019-03-28 9:47:15.052424 - DEBUG --> GFFormsModel::save_entry(): Entry record created in the database. ID: 11. 
2019-03-28 9:47:15.052932 - DEBUG --> GFFormsModel::save_entry(): Saving entry fields. 
2019-03-28 9:47:15.053294 - DEBUG --> GFFormsModel::queue_save_input_value(): Queued field operation: (#1 - text). 
2019-03-28 9:47:15.053599 - DEBUG --> GFFormsModel::queue_save_input_value(): Queued field operation: (#2 - text). 
2019-03-28 9:47:15.053874 - DEBUG --> GFFormsModel::queue_save_input_value(): Queued field operation: (#3 - text). 
2019-03-28 9:47:15.054152 - DEBUG --> GFFormsModel::queue_save_input_value(): Queued field operation: (#4 - text). 
2019-03-28 9:47:15.054442 - DEBUG --> GFFormsModel::queue_save_input_value(): Queued field operation: (#5 - text). 
2019-03-28 9:47:15.054723 - DEBUG --> GFFormsModel::queue_save_input_value(): Queued field operation: State/Province(#6 - select). 
2019-03-28 9:47:15.055032 - DEBUG --> GFFormsModel::queue_save_input_value(): Queued field operation: (#7 - text). 
2019-03-28 9:47:15.055319 - DEBUG --> GFFormsModel::queue_save_input_value(): Queued field operation: (#8 - text). 
2019-03-28 9:47:15.055610 - DEBUG --> GFFormsModel::queue_save_input_value(): Queued field operation: (#9 - text). 
2019-03-28 9:47:15.055886 - DEBUG --> GFFormsModel::queue_save_input_value(): Queued field operation: (#10 - text). 
2019-03-28 9:47:15.056159 - DEBUG --> GFFormsModel::queue_save_input_value(): Queued field operation: (#11 - text). 
2019-03-28 9:47:15.056469 - DEBUG --> GFFormsModel::queue_save_input_value(): Queued field operation: (#68.1 - consent). 
2019-03-28 9:47:15.056694 - DEBUG --> GFFormsModel::queue_save_input_value(): Queued field operation: (#68.2 - consent). 
2019-03-28 9:47:15.056906 - DEBUG --> GFFormsModel::queue_save_input_value(): Queued field operation: (#68.3 - consent). 
2019-03-28 9:47:15.057188 - DEBUG --> GFFormsModel::queue_save_input_value(): Queued field operation: Origin Fieldset(#18 - WrapperBegin). 
2019-03-28 9:47:15.057487 - DEBUG --> GFFormsModel::queue_save_input_value(): Queued field operation: (#20 - text). 
2019-03-28 9:47:15.057780 - DEBUG --> GFFormsModel::queue_save_input_value(): Queued field operation: State/Prov.(#22 - select). 
2019-03-28 9:47:15.058159 - DEBUG --> GFFormsModel::queue_save_input_value(): Queued field operation: (#24 - radio). 
2019-03-28 9:47:15.058475 - DEBUG --> GFFormsModel::queue_save_input_value(): Queued field operation: (#25.1 - checkbox). 
2019-03-28 9:47:15.058676 - DEBUG --> GFFormsModel::queue_save_input_value(): Queued field operation: (#25.2 - checkbox). 
2019-03-28 9:47:15.058861 - DEBUG --> GFFormsModel::queue_save_input_value(): Queued field operation: (#25.3 - checkbox). 
2019-03-28 9:47:15.059143 - DEBUG --> GFFormsModel::queue_save_input_value(): Queued field operation: Origin Fieldset(#19 - WrapperEnd). 
2019-03-28 9:47:15.059443 - DEBUG --> GFFormsModel::queue_save_input_value(): Queued field operation: Destination Fieldset(#26 - WrapperBegin). 
2019-03-28 9:47:15.059736 - DEBUG --> GFFormsModel::queue_save_input_value(): Queued field operation: (#28 - text). 
2019-03-28 9:47:15.060029 - DEBUG --> GFFormsModel::queue_save_input_value(): Queued field operation: State/Prov.(#29 - select). 
2019-03-28 9:47:15.060432 - DEBUG --> GFFormsModel::queue_save_input_value(): Queued field operation: (#30 - radio). 
2019-03-28 9:47:15.060965 - DEBUG --> GFFormsModel::queue_save_input_value(): Queued field operation: (#31.1 - checkbox). 
2019-03-28 9:47:15.061182 - DEBUG --> GFFormsModel::queue_save_input_value(): Queued field operation: (#31.2 - checkbox). 
2019-03-28 9:47:15.061398 - DEBUG --> GFFormsModel::queue_save_input_value(): Queued field operation: (#31.3 - checkbox). 
2019-03-28 9:47:15.061701 - DEBUG --> GFFormsModel::queue_save_input_value(): Queued field operation: Destination Fieldset(#27 - WrapperEnd). 
2019-03-28 9:47:15.062005 - DEBUG --> GFFormsModel::queue_save_input_value(): Queued field operation: TL (Truckload) or LTL (Less than Truckload)?(#34 - select). 
2019-03-28 9:47:15.063543 - DEBUG --> GFFormsModel::queue_save_input_value(): Queued field operation: Service Required(#50 - select). 
2019-03-28 9:47:15.063893 - DEBUG --> GFFormsModel::queue_save_input_value(): Queued field operation: Equipment Required(#51 - select). 
2019-03-28 9:47:15.064239 - DEBUG --> GFFormsModel::queue_save_input_value(): Queued field operation: On Pallets ?(#52 - select). 
2019-03-28 9:47:15.064611 - DEBUG --> GFFormsModel::queue_save_input_value(): Queued field operation: Total Weight:(#53 - text). 
2019-03-28 9:47:15.064991 - DEBUG --> GFFormsModel::queue_save_input_value(): Queued field operation: Lbs./ Kilos(#54 - select). 
2019-03-28 9:47:15.065385 - DEBUG --> GFFormsModel::queue_save_input_value(): Queued field operation: Any Hazardous Material ?(#57 - radio). 
2019-03-28 9:47:15.065709 - DEBUG --> GFFormsModel::queue_save_input_value(): Queued field operation: If Hazmat, Please Enter Class/U.N. #:(#56 - text). 
2019-03-28 9:47:15.066061 - DEBUG --> GFFormsModel::queue_save_input_value(): Queued field operation: Shipment Pickup Date:(#58 - radio). 
2019-03-28 9:47:15.066462 - DEBUG --> GFFormsModel::queue_save_input_value(): Queued field operation: Select a Shipping Date:(#59 - date). 
2019-03-28 9:47:15.066822 - DEBUG --> GFFormsModel::queue_save_input_value(): Queued field operation: General Description of Goods/Special Instructions:(#60 - textarea). 
2019-03-28 9:47:15.067152 - DEBUG --> GFFormsModel::queue_save_input_value(): Queued field operation: Please Contact Me By:(#61.1 - checkbox). 
2019-03-28 9:47:15.067397 - DEBUG --> GFFormsModel::queue_save_input_value(): Queued field operation: Please Contact Me By:(#61.2 - checkbox). 
2019-03-28 9:47:15.067598 - DEBUG --> GFFormsModel::queue_save_input_value(): Queued field operation: Please Contact Me By:(#61.3 - checkbox). 
2019-03-28 9:47:15.067914 - DEBUG --> GFFormsModel::queue_save_input_value(): Queued field operation: (#63.1 - consent). 
2019-03-28 9:47:15.068130 - DEBUG --> GFFormsModel::queue_save_input_value(): Queued field operation: (#63.2 - consent). 
2019-03-28 9:47:15.068391 - DEBUG --> GFFormsModel::queue_save_input_value(): Queued field operation: (#63.3 - consent). 
2019-03-28 9:47:15.075649 - DEBUG --> GFFormsModel::save_entry(): Finished saving entry fields. 
2019-03-28 9:47:15.075942 - DEBUG --> GF_Background_Process::dispatch(): Running for gf_feed_processor. 
2019-03-28 9:47:15.076766 - DEBUG --> GF_Background_Process::dispatch(): Unable to dispatch tasks to Admin Ajax: Nothing left to process 
2019-03-28 9:47:15.077013 - DEBUG --> GFFormsModel::create_post(): Starting. 
2019-03-28 9:47:15.079967 - DEBUG --> GFFormsModel::create_post(): Stopping. The form doesn't have any post fields. 
2019-03-28 9:47:15.080107 - DEBUG --> GFAPI::send_notifications(): Gathering notifications for form_submission event for entry #11. 
2019-03-28 9:47:15.080271 - DEBUG --> GFCommon::send_notifications(): Processing notifications for form_submission event for entry #11: Array
(
    [0] => 5c4735e5ea004
)

(only active/applicable notifications are sent) 
2019-03-28 9:47:15.080456 - DEBUG --> GFCommon::send_notification(): Starting to process notification (#5c4735e5ea004 - Admin Notification). 
2019-03-28 9:47:15.092461 - DEBUG --> GFCommon::send_email(): Sending email via wp_mail(). 
2019-03-28 9:47:15.092652 - DEBUG --> Array
(
    [to] => terry@hyperweb.ca
    [subject] => SNA Quote Form Submission
    [message] => <html>
	<head>
		<title>SNA Quote Form Submission</title>
	</head>
	<body>
		<strong><em>Online Freight Quote Contact Information</em></strong><br />
<br />
<strong>First Name</strong> : Nikolay<br />
<strong>Last Name</strong> : Birimski<br />
<strong>Company Name</strong> : Hyperweb Test<br />
<br />
<strong>Address</strong> : <br />
<strong>City</strong> : Hyperweb Test<br />
<strong>State/ Province</strong> : Yukon<br />
<br />
<strong>Zip/ Postal Code</strong> : <br />
<strong>Telephone</strong> : 08888888<br />
<strong>Mobile</strong> : <br />
<br />
<strong>Email</strong> : nicky@hyperweb.ca<br />
<br />
<strong><em>Online Rate Quote Shipping Information</em></strong><br />
<br />
<em>Origin</em><br />
<strong>City</strong> : Hyperweb Test<br />
<strong>State/ Prov</strong> : Arkansas<br />
<strong>Business/Residential (Origin)</strong> : Business<br />
<strong>Checkbox (Origin)</strong> : <br />
<br />
<em>Destination</em><br />
<strong>City</strong> : Hyperweb Test<br />
<strong>State/ Prov</strong> : Alaska<br />
<strong>Business/Residential (Destination)</strong> : Business<br />
<strong>Checkbox (Destination)</strong> : <br />
<br />
==============================================================<br />
<br />
<strong>TL (Truckload) or LTL (Less than Truckload)?</strong> : Truckload<br />
<br />
<em>Truckload</em><br />
<strong>Service Required</strong> : Standard Service<br />
<strong>Equipment Required</strong> : 53' High Cube Dry Van<br />
<strong>On Pallets ?</strong> : Yes<br />
<strong>Total Weight</strong> : 1<br />
<strong>Lbs./ Kilos</strong> : Kilos<br />
<br />
<em>LTL</em><br />
<strong>Stackable ?</strong> : <br />
<strong># of Loose Items</strong> : <br />
<strong># of Loose Boxes</strong> : <br />
<strong># of Pallets</strong> : <br />
<strong># of Crates</strong> : <br />
<br />
<strong>All dimensions are in:</strong> : <br />
<br />
<strong>Dimensions &amp; Quantities of Loose Items &amp; Boxes, Pallets and Crates</strong> : <br />
<br />
<strong>Service Required</strong> : <br />
<strong>Equipment Required</strong> : <br />
<strong>Total Weight</strong> : <br />
<strong>Lbs./ Kilos</strong> : <br />
<strong>Class</strong> : <br />
<strong>Tot. Value</strong> : <br />
<br />
==============================================================<br />
<br />
<strong>Any Hazardous Material ?</strong> : No<br />
<strong>If Hazmat, Please Enter Class/U.N. #</strong> : <br />
<br />
<strong>Shipment Pickup Date</strong> : Actual<br />
<strong>Select a Shipping Date</strong> : 15/03/2019<br />
<br />
<strong>General Description of Goods/Special Instructions</strong> : Hyperweb Test<br />
<br />
<strong>Please Contact Me By</strong> :<br />
<strong>Newsletter</strong> : 
	</body>
</html>
    [headers] => Array
        (
            [From] => From: "Ship North America" <nicky@hyperweb.ca>
            [Bcc] => Bcc: terry@hyperweb.ca
            [Content-type] => Content-type: text/html; charset=UTF-8
        )

    [attachments] => Array
        (
        )

    [abort_email] => 
)
 
2019-03-28 9:47:15.156177 - DEBUG --> GFCommon::send_email(): Result from wp_mail(): 1 
2019-03-28 9:47:15.156322 - DEBUG --> GFCommon::send_email(): Mail was passed from WordPress to the mail server. 
2019-03-28 9:47:15.157927 - DEBUG --> GFFormDisplay::handle_confirmation(): Sending confirmation. 
2019-03-28 9:47:15.158998 - DEBUG --> GFFormDisplay::handle_confirmation(): Confirmation => Array
(
    [redirect] => 
)
 
2019-03-28 9:47:15.159130 - DEBUG --> GFFormDisplay::process_form(): Executing functions hooked to gform_after_submission. 
2019-03-28 9:47:35.959644 - DEBUG --> GFCommon::post_to_manager(): endpoint: https://www.gravityhelp.com/wp-content/plugins/gravitymanager/api.php?op=upgrade_message&key=0c226b1ae0ce43b4c7100e1f679c3ac1 
2019-03-28 9:47:36.179590 - DEBUG --> GFCommon::log_remote_response(): code: 200; body: <!--GFM-->

```

---

<div class="post-metadata">

**Author:** ![hiranthi](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/hiranthi/32/359_2.png) [@hiranthi](https://community.gravityforms.com/u/hiranthi)\
**Post date:** [March 29, 2019, 9:10pm UTC](https://community.gravityforms.com/t/conditionally-cookies-save-after-checkbox-click/1376/9 "2019-03-29T21:10:07Z")

</div>

It appears that this line:  
`if ( false == $_POST['input_68'] ) return;`

Should actually be this:  
`if ( false == $_POST['input_68_1'] ) return;`

Could be input\_68\_3 too btw (they both have a value of `1`, which equals true).

---

<div class="post-metadata">

**Author:** ![chrishajer](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/chrishajer/32/88_2.png) [@chrishajer](https://community.gravityforms.com/u/chrishajer)\
**Post date:** [March 29, 2019, 9:22pm UTC](https://community.gravityforms.com/t/conditionally-cookies-save-after-checkbox-click/1376/10 "2019-03-29T21:22:54Z")

</div>

Actually, with the Consent field, it looks like it might be THIS!

`if ( false == $_POST['input_2_68_1'] ) return;`

 ![chrome_2019-03-29_16-22-32](https://us1.discourse-cdn.com/flex020/uploads/gravityforms1/original/2X/2/2239ac4711a0a6a3a9491b45a0b5bf95086a4077.png)

---

<div class="post-metadata">

**Author:** ![hiranthi](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/hiranthi/32/359_2.png) [@hiranthi](https://community.gravityforms.com/u/hiranthi)\
**Post date:** [March 29, 2019, 9:24pm UTC](https://community.gravityforms.com/t/conditionally-cookies-save-after-checkbox-click/1376/11 "2019-03-29T21:24:55Z")

</div>

I got mine from the ’ pre\_submission\_handler(): POST =\> Array’ output:

> [@hyperweb](#):
>
> [input\_68\_1] =\> 1  
> [input\_68\_2] =\> Save my contact information for future Freight Rate Quotes  
> [input\_68\_3] =\> 1

---

<div class="post-metadata">

**Author:** ![chrishajer](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/chrishajer/32/88_2.png) [@chrishajer](https://community.gravityforms.com/u/chrishajer)\
**Post date:** [March 29, 2019, 9:46pm UTC](https://community.gravityforms.com/t/conditionally-cookies-save-after-checkbox-click/1376/12 "2019-03-29T21:46:33Z")

</div>

Yeah, weird huh? I have not worked with the consent field. I am curious if any of that is present when the form is submitted if the box is NOT checked.

Also, I am wondering if the revision of what you are consenting to is stored in that id?

May have to experiment…

---

<div class="post-metadata">

**Author:** ![richardw8k](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/richardw8k/32/2354_2.png) [@richardw8k](https://community.gravityforms.com/u/richardw8k)\
**Post date:** [January 4, 2022, 5:31pm UTC](https://community.gravityforms.com/t/conditionally-cookies-save-after-checkbox-click/1376/13 "2022-01-04T17:31:11Z")

</div>


