我在解析我在 wordpress 中创建的自定义表单时遇到了很多麻烦,我在一个名为front-page.php
我的表单所在的页面上,解析器在一个名为的页面上formhandler.php
,我的解析器从一个单独的页面运行。
我真的很困惑,因为表单本身正在识别另一页上的解析器,只是没有真正解析数据并将您带到正确的页面。我得到一个很长的未知 URL,将我带到网站本身的 404 页面。
我需要帮助弄清楚为什么这个表单代码不起作用,或者解析器是否不在正确的位置来实际执行解析工作。我对 wordpress 还很陌生,所以现在有任何帮助。我现在必须为我的客户完成这项工作,任何帮助都会很棒。我只是以前不必在 WordPress 中使用自定义表单。
URL:
http://50.22.79.62/~pftech/formhandler.php?selection=http%3A%2F%2F50.22.79.62%2F~pftech%2Fwater-delivery-service%2F&zip=92115&home=on&did_submit=Get+Started%21
FORM PARSER:
<?php
if(isset($_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($_GET['zip'], $sandiego)){
header("Location: ".urldecode($_GET['selection'])."?zip=".$_GET['zip']."&type=".$_GET['type']);
} else {
header("Location: http://www.pureflo.com/");
}
exit;
}
?>
FORM:
<form method='get' id='gform_1' action='front-page.php'>
<div class="serviceinput">
<label for="services">Services: </label>
<select id="selection" name="selection">
<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="type" type="radio" id="homeradio" value="home" />
<div class="homelabel"> <label for="homeradio">Home</label></div>
<input name="type" type="radio" id="officeradio" value="office" />
<label for="officeradio">Office</label>
</div>
<div class="homebutton">
<input type='submit' id="submithome" name="did_submit" value="Get Started!">
</div>
</form>