誰かこのフォームで私を助けてください。クライアントのために今すぐこれを行う必要があり、迷っています! PHPで最高ではありません。ユーザーがフォームに入力するたびに、フォームに追加された入力に基づいて URL をリダイレクトする必要があります。たとえば、リストされているドロップダウンのいずれかを選択すると、その特定のページに移動します。示されているように、私は実際にすべての作業をjavascriptで行いました。私が助けを必要とする次の部分は、サンディエゴの正しい郵便番号を入力すると、ドロップダウンで選択したページに移動することです. サンディエゴの正しい郵便番号を入力しないと、別の「全国ページ」に移動します。ドロップダウンの選択を完全にオーバーライドします。私は本当にこれについて助けが必要です, 誰でも私を助けてもらえますか?私は今何をすべきかについて非常に迷っているので、追加できる入力をありがとう...
<script type="text/javascript">
function setAction(nPage){
document.forms[0].action = nPage;
}
</script>
<?php
$zip = $_GET['zip'];
$sandiego = array('91911', '91914', '91915', '91932', '91942', '91945', '91950', '92014', '92025', '92027', '92029', '92037', '92064', '92065', '92067', '92071', '92075', '92101', '92102', '92103', '92104', '92105', '92106', '92107', '92108', '92109', '92110', '92111', '92113', '92114', '92115', '92116', '92117', '92118', '92119', '92120', '92121', '92122', '92123', '92124', '92126', '92127', '92128', '92129', '92130', '92131', '92132', '92134', '92135', '92139', '92140', '92145', '92147', '92154', '92173');
if (in_array($zip, $sandiego)){
header("Location: http://www.pureflo.com/");
} else {
header("Location: http://www.pureflo.com/");
}
?>
<form method='post' enctype='multipart/form-data' id='gform_1' action='front-page.php'>
<div class="serviceinput"
<label for="services">Services: </label>
<select id="selection" onchange="setAction(this.value)">
<option value=''>Select a Service</option>
<option value='http://50.22.79.62/~pftech/water-delivery-service/'>Water Delivery</option>
<option value='http://50.22.79.62/~pftech/coffee-delivery/'>Coffee Services</option>
<option value='http://50.22.79.62/~pftech/water-filtration-systems/'>Water Filtration</option>
</select>
</div>
<div class="zipcode">
<label for="zip">Zip Code: </label>
<input name="zip" type="text" maxlength="5" id="zip" /></div>
<div class="frontradio"><input name="home" type="radio" id="homeradio" />
<div class="homelabel"> <label for="homeradio">Home</label></div>
<input name="home" type="radio" id="officeradio" />
<label for="officeradio">Office</label></div>
<div class="homebutton">
<input type='submit' id="submithome" name="did_submit" value="Get Started!">
</div>
</form>