FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » echo other way to output a constant?
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: echo other way to output a constant? [message #169484 is a reply to message #169476] Wed, 15 September 2010 01:45 Go to previous messageGo to previous message
rf is currently offline  rf
Messages: 19
Registered: September 2010
Karma:
Junior Member
"MikeB" <mpbrede(at)gmail(dot)com> wrote in message
news:4c8ff366(at)news(dot)x-privat(dot)org...
> Say I have the following code:
>
> <?php
>
>
> define('MAX_FILE_SIZE', 300);
>
> echo <<<_END
> <html><head><title>PHP Form Upload</title></head><body>
> <form method='post' action='UploadFile2.php'
> enctype='multipart/form-data'>
> <!-- MAX_FILE_SIZE must precede the file input field -->
> <input type="hidden" name="MAX_FILE_SIZE" value="" />
> Select a JPG, GIF, PNG or TIF File:
> <input type='file' name='filename' size='60' />
> <br/><input type='submit' value='Upload' /></form>
> _END;
>
> echo "</body></html>";
> ?>
>
> How can I get PHP to place the value of the constant MAX_FILE_SIZE in the
> value attribute for the hidden field MAX_FILE_SIZE?
>
> Since it does not start with a $-sign it is not interpreted as a variable.
> I tried putting it in curly braces {}, which sometimes work, but that
> didn't do the trick either.

All of this is mentioned in the manual.

echo <<<_END
<html><head><title>PHP Form Upload</title></head><body>
<form method='post' action='UploadFile2.php' enctype='multipart/form-data'>
<!-- MAX_FILE_SIZE must precede the file input field -->
<input type="hidden" name="MAX_FILE_SIZE" value="
_END;

echo MAX_FILE_SIZE;

echo <<<_END
" />
Select a JPG, GIF, PNG or TIF File:
<input type='file' name='filename' size='60' />
<br/><input type='submit' value='Upload' /></form>
_END;
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Removing insignificant decimal characters?
Next Topic: Reference # in var_dump output?
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Fri Sep 20 19:32:09 GMT 2024

Total time taken to generate the page: 0.05521 seconds