Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Back to <?php ?> in print<<<BLOCK 1

Status
Not open for further replies.

bitwise

Programmer
Mar 15, 2001
269
US
Is there anyway to have a print block such as:

<?php
print<<<HTML_DUMP
...
...
...
HTML_DUMP;
?>

And in that block of HTML can you switch back to PHP and execute some statements? For example,

<?php
print<<<HTML_DUMP
...
<input type="hidden" name="example" value="<?php echo $var; ?>">
...
HTML_DUMP;
?>

See what I mean? Can you some how accomplish this (i.e. get the value of "$var" set to the actual value of the hidden html field while in the middle of a HTML_DUMP block? Thanks.
 
you cannot perform functions inside heredoc.

you can do this include variables happily though

Code:
<?php
print<<<HTML_DUMP
...
<input type="hidden" name="example" value="[red]$var[/red]">
...
HTML_DUMP;
?>

i.e. variables are expanded within the heredoc syntax. for arrays you need to use curly braces to disambiguate.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top