0

この現在の構文でフォームを解析しようとしていますが、ほとんどすべてが正しいと確信しています。私はちょうどこのエラーを取得し続けます: Parse error: syntax error, unexpected T_VARIABLE in /home/pftech/public_html/wp-content/themes/pureflo/formhandler.php 行 13. これが何であるか、そしてその理由についてここで本当に迷っていますフォーム全体が失敗する原因となります。この件について何かご助力いただければ幸いです。たった今負けた。ありがとう!

<?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 に答える