-2

I want do this:

if(substr($xxx, -1)=="yyyyy"){
     $rrr = str_replace('xxx', 'yyyyy', $uuu);
     if (property_exists($this, $yyyy)){
        echo "if(!this.value){"
            echo "  var yyyy= dijit.byId('$yyyy').get('value');";
        echo " if(yyyy){"
        echo "  var aaaaa = getDate('$this');"; 
        echo "  yyyy.constraints.min=aaaaa;";
        echo " }";
        echo "}";
      }
}

I have an error when I try to add my code JavaScript . My error is:

Parse error: syntax error, unexpected 'echo' (T_ECHO), expecting ',' or ';' in D:/www/********* on line **** (
echo "if(!this.value){" echo " var yyyy= dijit.byId('$yyyy').get('value');";)

Anyone can help me ? Thanks

jyrkim
  • 2,849
  • 1
  • 24
  • 33
krowry
  • 73
  • 7

1 Answers1

1

You're missing several semicolons, why not use heredoc? i.e.:

<?php
if(substr($xxx, -1)=="yyyyy"){
    $rrr = str_replace('xxx', 'yyyyy', $uuu);
    if (property_exists($this, $yyyy)){
        echo <<< EOF
        if(!this.value){
            var yyyy= dijit.byId('$yyyy').get('value');
            if(yyyy){
                var aaaaa = getDate('$this'); 
                yyyy.constraints.min=aaaaa;
                }
        }
EOF;
    }
}
Pedro Lobito
  • 94,083
  • 31
  • 258
  • 268