ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Redirect a user using a checkbox

June 22, 2007 2:15pm

Subscribe [2]
  • #1 / Jun 22, 2007 2:15pm

    Jeremy Latham

    74 posts

    On the main page of my site, a user needs to check a checkbox to indicate they are of legal age.

    If they check the box they need to be sent to the homepage, if not they need to be redirected to a different url.

    It seems to me that this should be very easy - something like:

    if checkbox “on” go here…
    else go here…

    But I’m totally stumped. Is there a relatively straight-forward way to do this?

    Any help or direction would be much appreciated.

  • #2 / Jun 22, 2007 3:28pm

    Jeremy Latham

    74 posts

    I solved my problem using a simple php file.

  • #3 / Jun 22, 2007 4:50pm

    Christian Sweatt

    281 posts

    Would you care to post what you did to make this happen, just in case someone else has this problem and are able to find a solution?  I’m sure there will be someone else out there with a similar question.

    Thanks!

  • #4 / Jun 23, 2007 6:50pm

    Jeremy Latham

    74 posts

    I googled age-validation redirect and found this entry about age-validation redirect. By looking at the code I was able to figure out this code for a checkbox:

    <?php
    $ofage = $_POST['ofage'];
    if ($ofage=="on") {
        header("Location: ../index.php/home");
        exit;
    }
    else {
        header("Location: <a href="http://www.google.com">http://www.google.com"</a>);
        exit;
    }
    ?>

    As you may have noticed - I don’t know any PHP so this was really exciting for me to be able to make this happen.

  • #5 / Jun 23, 2007 6:52pm

    Christian Sweatt

    281 posts

    Great!  Thanks a lot.  I’m not a PHP person, either, so this is great.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases