Created
January 27, 2012 16:27
-
-
Save jonharmon/1689612 to your computer and use it in GitHub Desktop.
Zip Form Redirect to another jQuery Tab
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="instantquoter" class="reveal-modal"> | |
<script src="http://cdn.jquerytools.org/1.2.6/full/jquery.tools.min.js"></script> | |
<script> | |
$(function() { | |
$("ul.tabs").tabs("div.main > div.panes"); | |
}); | |
</script> | |
<ul class="tabs"> | |
<li><a href="#location-form">Enter a New Location</a></li> | |
<li><a href="#southbend-quotes">South Bend</a></li> | |
<li><a href="#valpo-quotes">Valparaiso</a></li> | |
<li><a href="#ftwayne-quotes">Fort Wayne</a></li> | |
</ul> | |
<div class="main"> | |
<div class="panes" id="location-form"> | |
<form action="<?php bloginfo('template_url'); ?>/redirect.php" method="post"> | |
<div class="sm-form-input"> | |
<label>Enter your Zip Code</label> | |
<input type="text" name="zip"> | |
</div> | |
<input type="submit" name="submit" class="submit" value="Submit"> | |
</form> | |
</div> | |
<div class="panes" id="southbend-quotes">South Bend</div> | |
<div class="panes" id="valpo-quotes">Valpo</div> | |
<div class="panes" id="ftwayne-quotes">Fort Wayne</div> | |
</div> | |
<a class="close-reveal-modal">×</a> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$location= $_POST['zip']; | |
if ( $location == 111 || $location == 222 ) { | |
Redirect("southbend-quotes"); | |
} elseif ( $location == 333 || $location == 444 ) { | |
Redirect("valpo-quotes"); | |
} elseif ( $location == 555 || $location == 666 ) { | |
Redirect("ftwayne-quotes"); | |
} else { | |
echo "Zip Code Not Recognized, Please Call us at 800-246-2456 for a FREE Quote!"; | |
} | |
function Redirect($string) { ?> | |
<script type="text/javascript"> | |
$(function() { | |
var divname = "<?php echo $string ?>"; | |
$("#"+divname).show("slow").siblings().hide("slow"); | |
</script> | |
<?php | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment