Updating:
The php is considering the code beyond the EOM; closing tag.
Here is how my script is structured:
<?php
switch($x){
case "a":
$var = <<< EOM;
...the html...
EOM;
break;
case "b":
...some code...
break;
}
?>
And the script is giving erro just after the EOM;
Old:
I'm using the following code.
$var = <<< EOM
... some html ...
<?php
if (date("j",strtotime($row["dinicio"]))==$i){echo "selected='selected'";}
?>
EOM;>
but it fails with the following error
Parse error: syntax error, unexpected '"', expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\Apache\htdocs\ancp\adm\adm_functions.php on line 132
removing the $row['dinicio'] solves the problem. but i need this field
Any ideas?
Edit:
For more reference here a more 'complete' segment:
<select id="ddia" name="ddia" class="form-normal">
<option value="-1">dia</option>
<?php
for ($i=1; $i<32; $i++){
echo "<option value='";
echo ($i<10)?"0":"";
echo "$i' ";
if (date("j",strtotime($row["dinicio"]))==$i){echo "selected='selected'";}
echo ">$i</option>\n";
}
?>
</select>
$EOMand the<?php?heredocaltogether. Consider using a template engine as this is apparently what you are going for anyway.