Hi, I am still a newbie in php. Is there a shorter way to include a php
value in a form?
{$user['fullname']}; ?>" />
is it possible to do smth like this =3Dphp {$user['fullname']}; ?> like i=
n
JSP?
Can I omit the last whitespace before the closing ?> ?
***
I tried to download the file from another server the fancy way in PHP, but
it just display blank screen. Can You please look at my code:
$filepath =3D "http://aaaaaa.yolasite.com/resources/happytears.doc";
// $filepath =3D "http://users.skavt.net/~gleskovs/else/happytears.doc
://users.skavt.net/%7Egleskovs/else/happytears.doc>
";
if (file_exists($filepath)) {
header("Content-Type: application/force-download");
header("Content-Disposition:filename=3D\"happytears.doc\"");
$fd =3D fopen($filepath,'rb');//I tried also just 'r' and am not clear=
on
which documents should I add b for binary? As I understand only text plain
files and html files and php etc files are without 'b'. All documents,
presentations, mp3 files, video files should have also 'b' for binary along
r. Am I wrong?
fpassthru($fd);
fclose($fd);
}
?>
Both filepaths are valid and accessible to the same document. I double
checked them. Please help me. Thanks in advance, Yours, Grega
-- Peace refuge:
http://users.skavt.net/~gleskovs/
When the sun rises I receive and when it sets I forgive;) Grega Leskov=C5=
=A1ek
--00148530af26dc2a9b0471e5432d--
Re: inserting php value in html shorter wayand downloadingwinword & mp3 files the fancy way
am 24.08.2009 18:10:38 von Ashley Sheridan
On Mon, 2009-08-24 at 17:56 +0200, Grega Leskovšek wrote:
> Hi, I am still a newbie in php. Is there a shorter way to include a php
> value in a form?
>
> {$user['fullname']}; ?>" />
> is it possible to do smth like this =3Dphp {$user['fullname']}; ?> like=
in
> JSP?
> Can I omit the last whitespace before the closing ?> ?
>=20
> ***
> I tried to download the file from another server the fancy way in PHP, bu=
t
> it just display blank screen. Can You please look at my code:
>=20
>
> $filepath =3D "http://aaaaaa.yolasite.com/resources/happytears.doc";
> // $filepath =3D "http://users.skavt.net/~gleskovs/else/happytears.doc
tp://users.skavt.net/%7Egleskovs/else/happytears.doc>
> ";
> if (file_exists($filepath)) {
> header("Content-Type: application/force-download");
> header("Content-Disposition:filename=3D\"happytears.doc\"");
> $fd =3D fopen($filepath,'rb');//I tried also just 'r' and am not cle=
ar on
> which documents should I add b for binary? As I understand only text plai=
n
> files and html files and php etc files are without 'b'. All documents,
> presentations, mp3 files, video files should have also 'b' for binary alo=
ng
> r. Am I wrong?
> fpassthru($fd);
> fclose($fd);
> }
> ?>
> Both filepaths are valid and accessible to the same document. I double
> checked them. Please help me. Thanks in advance, Yours, Grega
>=20
> -- Peace refuge:
> http://users.skavt.net/~gleskovs/
> When the sun rises I receive and when it sets I forgive;) Grega Leskov=C5=
=A1ek
There is a shorttag syntax for a basic PHP echo, and you nearly had it
in your code example:
=3D$user['fullname']?>
But this will only work on a setup that has shorttags enabled, and a lot
of shared hosts don't by default. Have you looked at heredoc?
print <<
EOC;
Thanks,
Ash
http://www.ashleysheridan.co.uk
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: inserting php value in html shorter wayand downloading
am 24.08.2009 18:36:40 von Paul M Foster
On Mon, Aug 24, 2009 at 05:56:46PM +0200, Grega Leskov??ek wrote:
> Hi, I am still a newbie in php. Is there a shorter way to include a php
> value in a form?
>
> is it possible to do smth like this =php {$user['fullname']}; ?> like in
> JSP?
> Can I omit the last whitespace before the closing ?> ?
Yes, you can include a PHP value in a script. Like this:
....size="40" value="" />
Your curly braces are redundant, and you must quote the "fullname" index
if you're not quoting the whole $user['fullname'] expression. Yes, you
can remove the final space after $user['fullname']; and before the tag
closure (?>). But there's no reason to.
Paul
--
Paul M. Foster
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php