wordpress - In PHP, how do I specify different form actions depending on input text? -
so basically, if type in zip code between 85700 , 85775 want post to: http://medicarechoicesofarizona.com/
if else entered, want post http://www.ehealthmedicare.com below. guess javascript fine php great because wordpress widget. everyone!
<form action="http://www.ehealthmedicare.com/find-coverage?allid=med35993" method="post" target="blank" _lpchecked="1"> <p style="font-size:16px; text-align:center"> zip code: <input type="text" name="zip" style="width:60px; height: 25px;"> </p> <p style="text-align:center"> <input type="image" src="/wp-content/plugins/medicare-quote-widget/ehealth-medicare-go.png" title="find medicare insurance options" alt="find medicare insurance options" class="go-btn"> </p> </form>
actually, can done pure php:
<form action="forwarder.php" method="post" target="blank" _lpchecked="1"> <p style="font-size:16px; text-align:center"> zip code: <input type="text" name="zip" style="width:60px; height: 25px;"> </p> <p style="text-align:center"> <input type="image" src="/wp-content/plugins/medicare-quote-widget/ehealth-medicare-go.png" title="find medicare insurance options" alt="find medicare insurance options" class="go-btn"> </p> </form>
and add forwarder.php
:
<?php if($_post) { $zip = (int)$_post['zip']; if($zip >= 85700 && $zip <= 85775) { header('location: http://medicarechoicesofarizona.com/'); } else { header('location: http://www.ehealthmedicare.com/find-coverage?allid=med35993'); } } ?>
Comments
Post a Comment