Different landing pages by zip code

1 replies
  • WEB DESIGN
  • |
I want to have my landing page with a zip code submit and based on that I want to send people to different sales pages. How do I set up the if/then in html?
#code #landing #pages #zip
  • Profile picture of the author Peter Olson
    You can do it w/ php easily. If you are using POST to send the zip code you could do somethign like:
    PHP Code:
    <?php
    $zipcode 
    $REQUEST["zip"];
    if (
    $zipcode == '68114') {
    $redirectUrl 'http://whateverurl.com';
    else if (
    $zipcode == '68115') {
     
    $redirectUrl 'http://whateverurl2.com';
    }
    else if (
    $zipcode == '68116') {
     
    $redirectUrl 'http://whateverurl3.com';
    }
    //you could keep doing else if's.
    else {
     
    $redirectUrl 'http://whateverurlrandom.com';
    }

    //this is our custom outbound php redirect
    $code = <<<EOT
                <html>
                <head>
                    <meta http-equiv='refresh' content='1; url=
    $redirectUrl'>
                </head>
                <body>
                    <script type='text/javascript'>window.location='
    $redirectUrl';</script>
                </body>
            </html>";
    EOT;

    echo 
    $code;
    ?>
    I think that would do it... didn't test it though.
    {{ DiscussionBoard.errors[2497027].message }}

Trending Topics