Skip to content

Instantly share code, notes, and snippets.

@jonharmon
Created January 27, 2012 16:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jonharmon/1689612 to your computer and use it in GitHub Desktop.
Save jonharmon/1689612 to your computer and use it in GitHub Desktop.
Zip Form Redirect to another jQuery Tab
<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">&#215;</a>
</div>
<?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