I’m trying to set up a conditional confirmation that directs people to a different page depending upon their Likert Survey Score. We have scoring activated. I added this PHP to my functions.php but it always redirects people to /blog/ regardless of their score. Any ideas if what I’m trying to do is possible?
add_filter( ‘gform_confirmation_80’, ‘custom_confirmation_logic’, 10, 4 );
function custom_confirmation_logic( $confirmation, $form, $entry, $ajax ) {
// Accessing the total survey score from the entry
$total_score = rgar( $entry, ‘survey_total_score’ );
Thanks Faisal and Juan for your suggestions. Faisal I used var_dump and got this result: string(0) “”. I also tried using this PHP code below using the field ID but it also returned a blank value.
On the Confirmation settings if I enter {survey_total_score} or {score:id=1} for the Pass Field Data via Query String it properly appends the URL with the total score. I reached out to Gravity Form support for help.
// Accessing the score from the field with ID 1
$score_field_id = '1'; // Adjust this to the correct field ID
$score = rgar( $entry, $score_field_id );