解析错误:语法错误,意外T_CONSTANT_ENCAPSED_STRING?

时间:2013-04-25 15:43:47

标签: php forms error-handling

我有一个可怕的时间弄清楚这个错误,我只是让表单本身工作得非常好。比客户给我一个新的邮政编码列表,以放入更新版本。我把这些新的邮政编码放入,我不断收到此错误: 在第8行的/home/pftech/public_html/wp-content/themes/pureflo/formhandler.php中解析错误:语法错误,意外的T_CONSTANT_ENCAPSED_STRING,期待')'

我很困惑为什么现在正在发生这种情况。我能不能得到一些帮助,我觉得这很容易。代码如下。感谢

FORM HANDLER :
<?php
/**
 * Template Name: Form Handler
 */
?>  
 <?php
    if(isset($_GET['zip'])){
$sandiego = array(‘91901’, ‘91902’, ‘91903’, ‘91908’, ‘91909’, ‘91910’, ‘91911’, ‘91912’, ‘91913’, ‘91914’, ‘91915’, ‘91916’, ‘91921’, ‘91932’, ‘91933’, ‘91935’, ‘91941’, ‘91942’, ‘91943’, ‘91944’, ‘91945’, ‘91946’, ‘91947’, ‘91948’, ‘91950’, ‘91951’, ‘91962’, ‘91976’, ‘91977’, ‘91978’, ‘91979’, ‘91990’, ‘92003’, ‘92007’, ‘92008’, ‘92009’, ‘92010’, ‘92011’, ‘92013’, ‘92014’, ‘92018’, ‘92019’, ‘92020’, ‘92021’, ‘92022’, ‘92023’, ‘92024’, ‘92025’, ‘92026’, ‘92027’, ‘92028’, ‘92029’, ’92030’, ‘92033’, ‘92037’, ‘92038’, ‘92039’, ‘92040’, ‘92046’, ‘92049’, ‘92051’, ‘92052’, ‘92054’, ‘92055’, ‘92056’, ‘92057’, ‘92059’, ‘92060’, ‘92061’, ‘92064’, ‘92065’, ‘92067’, ‘92068’, ‘92069’, ‘92070’, ‘92071’, ‘92072’, ‘92074’, ‘92075', ‘92078’, ‘92079’, ‘92081’, ‘92082’, ‘92083’, ‘92084’, ‘92085’, ‘92088’, ‘92090’, ‘92091’, ‘92092’, ‘92093’, ‘92096’, ‘92101’, ‘92102’, ‘92103’, ‘92104’, ‘92105’, ‘92106’, ‘92107’, ‘92108’, ‘92109’, ‘92110’, ‘92111’, '92112’, ‘92113’, ‘92114’, ‘92115’, ‘92116’, ‘92117’, ‘92118’, ‘92119’, ‘92120’, ‘92121’, ‘92122’, ‘92123’, ‘92124’, ‘92126’, ‘92127’, ‘92128’, ‘92129’, ‘92130’, ‘92131’, ‘92132’, ‘92133’, ‘92134’, ‘92135', ‘92136’, ‘92137’, ‘92138’, ‘92139’, ‘92140’, ‘92142’, ‘92143’, ‘92145’, ‘92147’, ‘92149’, ‘92150', ‘92152’, ‘92153’, ‘92154’, ‘92155’, ‘92158’, ‘92159’, ‘92160’, ‘92161’, ‘92162’, ‘92163’, ‘92164', '92165’, ‘92166’, ‘92167’, ‘92168’, ‘92169’, ‘92170’, ‘92171’, ‘92172’, ‘92173’, ‘92174’, ‘92175', '92176’, ‘92177’, ‘92178’, ‘92179', ‘92182’, ‘92184’, ‘92186’, ‘92187’, ‘92190’, ‘92191’, ‘92192’, ‘92193’, ‘92194’, ‘92195’, ‘92196’, ‘92197’, ‘92198’, ‘92199’, ‘92592’, ‘92590’, ‘92562’, ‘92563’, ‘92591’, '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["home"] == "homeradio") { 
                $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/";

            } elseif($_GET["home"] == "officeradio") {
                $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/";
            }
            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;
?>

FORM: 
<div class="home-form">

<form method='get' id='gform_1'  action='http://50.22.79.62/~pftech/form-handler/'>

<div class="serviceinput"

<label for="services">Services: </label>

<select id="selection" name="selection">

<option value="-1">Select Service</option>

<option value="0">Water Delivery</option>

<option value="1">Coffee Services</option>

<option value="2">Water Filtration</option>

</select>

</div>

&nbsp;

<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" value="homeradio" />

   <div class="homelabel"> 

   <label for="homeradio">Home</label></div>

    <input name="home" type="radio" value="officeradio" />

    <label for="officeradio">Office</label></div>

<div class="homebutton">

<input type='submit' id="submithome" name="did_submit" value="Get Started!">

</div>

</div>

</form>

1 个答案:

答案 0 :(得分:1)

您的$ sandiego数组错误,您不能使用`分隔符使用单引号。