PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

conditional redirect works, but need redirect script to check one more field

  1. I followed the instructions at http://www.gravityhelp.com/forums/topic/terms-of-conditions#post-7442 to get conditional redirects to work, and that php script worked great for me. However, in my case, the field that is looked at by the conditional redirect script is itself a conditional field that only shows up if the user identifies himself as homeowner or building owner.

    What I need for the script to do is to address those folks who didn't even get to see this field (because it doesn't show up for them if they aren't homeowner or building owner) and to redirect them to a traditional thank you page at http://solarbridgetech.com/contact-us/thank-you/

    I was trying to add something like this code below to the PHP, but I clearly don't know what I'm doing when it comes to PHP.

    ' case "is_null":

    // if no value defined, redirect to the following page

    header("Location: http://solarbridgetech.com/contact-us/thank-you/");

    break;

    }
    '

    I also tried "null" "empty" and maybe some other stuff. Basically I want to add something in that says "if you didn't submit something for this field, then you go to our redirect page at http://solarbridgetech.com/contact-us/thank-you. But I don't know if that would work. Perhaps there is a better way of doing it, maybe by saying if you filled out another field this way (perhaps another drop down that is required by all users), then redirect to http://solarbridgetech.com/contact-us/thank-you

    My form is at http://solarbridge.staging.wpengine.com/contact-us/contact-us/

    One work-around I've thought of is to actually create two separate forms and have the user identify themselves right away to determine which form to fill out, but I don't know if my client will be happy with that solution.

    Posted 12 years ago on Tuesday February 28, 2012 | Permalink
  2. I had a programmer help me figure this out. The code that should be added is as follows:

    default:

    // if no value defined, redirect to the following page

    header("Location: http://solarbridgetech.com/contact-us/thank-you/");

    break;

    Posted 12 years ago on Thursday March 1, 2012 | Permalink