解析错误:语法错误,意外T_VARIABLE,期待','或';'排队

时间:2017-09-27 10:34:20

标签: php html forms contact-form

我需要帮助,这是我得到语法错误的代码。 thx guys

            <?
                if ($_POST['provincia']){
                echo "<option value="$_POST[pronvicia]" selected="selected">$_POST[provincia]</option>";}

                else{
                echo "<option value="" selected="selected">seleziona</option>";};
            ?>

4 个答案:

答案 0 :(得分:1)

将您的字符串与.合并,并在需要时使用'

 <?php
                if ($_POST['provincia']){
                echo "<option value=".$_POST['pronvicia']."  selected='selected'>".$_POST['provincia']."</option>";}

                else{
                echo "<option value='' selected='selected'>seleziona</option>";}
            ?>

答案 1 :(得分:0)

或者:

app.controller('demo', ['$scope', 'ngDialog', function($scope, ngDialog) {
  $scope.openDialog = function() {
    ngDialog.openConfirm({
      templateUrl: 'dialog-template.html',
      scope: $scope
    }).then(function () {
      console.log('confirm');
    }).catch(function () {
      console.log('cancel');
    })
  }
}])

或者:

echo "<option value='$_POST[pronvicia]' selected='selected'>$_POST[provincia]</option>";}

答案 2 :(得分:0)

代码应如下所示

 <?
            if ($_POST['provincia']){
            echo "<option value=".$_POST[pronvicia]." selected='selected'>".$_POST[provincia]."</option>";}

            else{
            echo "<option value='' selected='selected'>seleziona</option>";};
        ?>

答案 3 :(得分:0)

使用此

<?php
                   if ($_POST['provincia']){
        echo '<option value="'.$_POST['pronvicia'].'" selected="selected">'.$_POST['provincia'].'</option>';
    }
else{
        echo '<option value="" selected="selected">seleziona</option>';
    }
            ?>