0

我正在尝试使用当前语法解析表单,并且我很确定大部分内容都是正确的。我只是不断收到此错误:解析错误:语法错误,第 13 行 /home/pftech/public_html/wp-content/themes/pureflo/formhandler.php 中的意外 T_VARIABLE。我真的迷失了这可能是什么以及为什么它导致整个表格失败。请对此事提供任何帮助,我们将不胜感激。刚刚迷路了。谢谢!

<?php
/**
 * Template Name: Form Handler
 */
?>  
 <?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', '92562', '92563', '92590', '92591', '92592', '92596');
      if (in_array($_GET['zip'], $sandiego)){
          $urls = array();
            if($_GET["office"] == 1) { 
                $urls[] = "http://50.22.79.62/~pftech/office-delivery/"
                $urls[] = "http://50.22.79.62/~pftech/office-delivery/"
                $urls[] = "http://50.22.79.62/~pftech/office-delivery/"
            } else {
                $urls[] = "http://50.22.79.62/~pftech/water-delivery-service/"
                $urls[] = "http://50.22.79.62/~pftech/coffee-delivery/"
                $urls[] = "http://50.22.79.62/~pftech/water-filtration-systems/"
            }
            if($_GET['selection'] < 3 && $_GET['selection'] >= 0) {
                $URL = $urls[$_GET['selection']];
                header("Location: $URL?zip=$_GET[zip]");
            } else header("Location: http://50.22.79.62/~pftech/nationwide/"); 
        } else {
            header("Location: http://50.22.79.62/~pftech/nationwide/");
        }
    }
    exit;
4

2 回答 2

2

;每行后没有分隔符

于 2013-04-18T15:08:53.860 回答
1

此代码有效

    <?php
/**
 * Template Name: Form Handler
 */
?>  
 <?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', '92562', '92563', '92590', '92591', '92592', '92596');
      if (in_array($_GET['zip'], $sandiego)){
          $urls = array();
            if($_GET["office"] == 1) { 
                $urls[] = "http://50.22.79.62/~pftech/office-delivery/";
                $urls[] = "http://50.22.79.62/~pftech/office-delivery/";
                $urls[] = "http://50.22.79.62/~pftech/office-delivery/";
            } else {
                $urls[] = "http://50.22.79.62/~pftech/water-delivery-service/";
                $urls[] = "http://50.22.79.62/~pftech/coffee-delivery/";
                $urls[] = "http://50.22.79.62/~pftech/water-filtration-systems/";
            }
            if($_GET['selection'] < 3 && $_GET['selection'] >= 0) {
                $URL = $urls[$_GET['selection']];
                header("Location: $URL?zip=$_GET[zip]");
            } else header("Location: http://50.22.79.62/~pftech/nationwide/"); 
        } else {
            header("Location: http://50.22.79.62/~pftech/nationwide/");
        }
    }
    exit;
?>

我添加了;这结束了一个 php 函数

于 2013-04-18T15:10:54.910 回答